Public feed #377460

Something

public text v1 · immutable
Raw Edit
·published 2007-03-01 19:45 UTC
rendered paste body
This is the script that is failing to compile, and crashing the compiling software.

   1.
      #include <a_samp>
   2.
      // for the samp stuff
   3. #include <dutils>
      // for the functions dini and dudb need
   4.
   5.#include <dudb>
      // for the userdatabase, get dudb version 2.0 for this.
   6.
      #define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1
   7.
      #define COLOR_SYSTEM 0xEFEFF7AA
   8.

   9.
      #define COLOR_RED 0xAA3333AA
  10.
      #define COLOR_GREY 0xAFAFAFAA
  11.
      #define COLOR_GREEN 0x33AA33AA
  12.
      #define COLOR_YELLOW 0xFFFF00AA
  13.

  14.
      new mitra[MAX_PLAYERS];
  15.
      new pistole[MAX_PLAYERS];
  16.
      new IsSpawned[MAX_PLAYERS];
  17.
      new PLAYERLIST_authed[MAX_PLAYERS];
  18.
      #define AUTOLOCO 0
  19.

  20.
      main()
  21.
      {
  22.
              print("\n----------------------------------");
  23.
              print("  Kirks Test TYC RPG Script ");
  24.
              print("----------------------------------\n");
  25.
      }
  26.

  27.
      public SystemMsg(playerid,msg[]) {
  28.
         if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
  29.
             SendClientMessage(playerid,COLOR_SYSTEM,msg);
  30.
         }
  31.
         return 1;
  32.
      }
  33.

  34.
      public PlayerName(playerid) {
  35.
        new name[MAX_PLAYER_NAME];
  36.
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  37.
        return name;
  38.
      }
  39.

  40.

  41.
      public OnGameModeInit()
  42.
      {
  43.
              print("GameModeInit()");
  44.
              SetGameModeText("RPG Mode - NOTHING ELSE");
  45.
      AddPlayerClass(105,2495.2942,-1686.7410,13.5146,345.1787,0,0,0,0,0,0); // GROVE
  46.
      AddPlayerClass(106,2495.2942,-1686.7410,13.5146,345.1787,0,0,0,0,0,0); // GROVE
  47.
      AddPlayerClass(107,2495.2942,-1686.7410,13.5146,345.1787,0,0,0,0,0,0); // GROVE
  48.
      AddPlayerClass(102,2040.8317,-1636.4535,13.5469,282.3436,0,0,0,0,0,0); // BALLAS
  49.
      AddPlayerClass(103,2045.2512,-1670.7961,13.3828,254.1668,0,0,0,0,0,0); // BALLAS
  50.
      AddPlayerClass(104,2034.1675,-1665.8888,13.5469,265.4936,0,0,0,0,0,0); // BALLAS
  51.
      AddPlayerClass(174,1787.3534,-1925.0656,13.3901,307.9801,0,0,0,0,0,0); // OG
  52.
      AddPlayerClass(115,1801.7134,-1912.9382,13.3960,340.8804,0,0,0,0,0,0); // OG
  53.
      AddPlayerClass(116,1792.5392,-1911.3932,13.3968,287.8483,0,0,0,0,0,0); // OG
  54.
      AddPlayerClass(108,2059.0715,-1007.3425,47.9766,1.1025,0,0,0,0,0,0); // VAGOS
  55.
      AddPlayerClass(109,2127.3621,-971.9185,58.6448,169.0507,0,0,0,0,0,0); // VAGOS
  56.
      AddPlayerClass(110,2186.0625,-998.1495,66.4688,78.2629,0,0,0,0,0,0); // VAGOS
  57.
      AddPlayerClass(217,1868.5045,-1384.3711,13.5127,79.3041,0,0,0,0,0,0); // BMX
  58.
      AddPlayerClass(250,1868.6322,-1383.8907,13.5134,79.3041,0,0,0,0,0,0); // BMX
  59.
      AddPlayerClass(293,1868.6322,-1383.8907,13.5134,79.3041,0,0,0,0,0,0); //BMX
  60.
      AddPlayerClass(98,1497.1262,-690.2004,94.7500,190.8699,0,0,0,0,0,0); // Rich
  61.
      AddPlayerClass(147,1497.1384,-688.9389,95.1966,184.3909,0,0,0,0,0,0); // Rich
  62.
      AddPlayerClass(156,2014.4757,-1732.6592,14.2392,91.7454,0,0,0,0,0,0); // Old
  63.
      AddPlayerClass(61,1788.0491,-2643.1636,13.5469,356.0182,0,0,0,0,0,0); // Pilot
  64.
      AddPlayerClass(287,2734.2253,-2450.5940,17.5937,336.5316,0,0,0,0,0,0); //Military
  65.
      AddPlayerClass(280,1576.8402,-1631.2933,13.3828,59.6309,0,0,0,0,0,0); // Police
  66.
      AddPlayerClass(280,1569.3383,-1619.6395,13.5469,148.4500,0,0,0,0,0,0); // Police
  67.
      AddPlayerClass(280,1556.2813,-1620.5048,13.5469,62.5959,0,0,0,0,0,0); // Police
  68.
      AddStaticVehicle(458,2517.0291,-1672.4581,13.8968,53.9456,113,1); // GroveStreetSolair
  69.
      AddStaticVehicle(466,2296.8979,-1633.0701,14.4439,356.4811,25,76); // GreenBottleGlendale
  70.
      AddStaticVehicle(492,2298.3022,-1645.5243,14.5286,270.6505,81,27); // GreenBottleGreenWood
  71.
      AddStaticVehicle(462,2198.5569,-1276.4036,24.1383,358.3150,14,14); // FaggioGardenNearGreenBottle
  72.
      AddStaticVehicle(578,2052.0168,-1940.1796,13.9676,269.0157,1,1); // DFTLayby
  73.
      AddStaticVehicle(400,1505.5155,-2360.6868,13.6431,1.1772,101,1); // LandStalkerLSAP
  74.
      AddStaticVehicle(419,1518.6495,-2361.1870,13.3552,179.8577,13,76); // EsperantoLSAP
  75.
      AddStaticVehicle(419,1457.7964,-2348.1006,13.3443,179.3872,13,76); // Esperanto2LSAP
  76.
      AddStaticVehicle(477,1331.0952,-1081.1213,25.0323,90.9786,121,1); // ZR3000 near VineWood
  77.
      AddStaticVehicle(535,2645.4460,-1990.6671,13.3178,0.3465,55,1); // locoslamvan
  78.
      AddStaticVehicle(532,1905.7791,192.6017,36.2052,352.0815,0,0); // Harvesterfield
  79.
      AddStaticVehicle(543,219.2118,25.1247,2.3968,267.3424,8,90); // truckxoomer
  80.
      AddStaticVehicle(400,-2207.1980,-2146.7263,46.3290,233.8678,4,1); // LandstalkerChiliad
  81.
      AddStaticVehicle(400,-2234.2571,-2167.9519,40.2118,32.6648,4,1); // Landstalkerchiliad 2
  82.
      AddStaticVehicle(483,-2226.9490,-2163.3030,41.7159,206.4084,16,0); // campervan chiliad
  83.
      AddStaticVehicle(508,-2223.0588,-2161.5708,42.8714,27.3742,1,1); // journeychiliad
  84.
      AddStaticVehicle(560,-1958.6025,261.6516,35.1759,14.9033,41,29); // wangssultan
  85.
      AddStaticVehicle(565,-1958.7087,303.2773,35.0946,122.6941,15,15); // FlashWangs
  86.
      AddStaticVehicle(565,-2506.6941,255.4485,34.7963,178.8440,15,15); // FlashKings
  87.
      AddStaticVehicle(579,-2513.7090,257.8713,35.1050,357.9512,15,15); // KingsHuntley
      
      AddStaticVehicle(458,1669.8694,1305.9108,10.6988,179.9549,109,1); // SolairLVAP
      
	  AddStaticVehicle(477,1666.5168,1316.6794,10.5729,359.9756,101,1); // ZR-350 LVAP

	  AddStaticVehicle(489,1650.4648,1286.9464,10.9713,179.8478,120,123); // RancherLVAP

      AddStaticVehicle(496,1701.8395,1316.7800,10.5370,359.5124,53,56); // BlistCompactLVAP

      AddStaticVehicle(496,1701.5864,1286.6661,10.5364,359.5281,53,56); // Blist2CompantLVAP

      AddStaticVehicle(487,1645.8623,1539.5914,10.9600,233.3095,26,3); // MaverickLVAP

      AddStaticVehicle(487,1628.9384,1529.6912,10.9716,230.5643,74,35); // ChopperLVAP

      AddStaticVehicle(511,1577.6918,1448.3977,12.2016,269.2121,8,66); // BeagleLVAP

      AddStaticVehicle(519,1324.1074,1597.8303,11.7424,84.3920,1,1); // ShamalLVAP

      AddStaticVehicle(446,-2325.3137,2326.6609,-0.4022,0.6024,1,53); // SqualoSFdocks

      AddStaticVehicle(430,-2409.1943,2318.4414,-0.0082,274.9771,46,26); // policeboatsfdocks


  	     return 1;
  89.
      }
  90.

  91.
      public OnPlayerRequestClass(playerid, classid)
  92.
      {
  93.
              printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
  94.
              SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  95.
              SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  96.
              SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  97.
              return 1;
  98.
      }
  99.

 100.
      public OnGameModeExit()
 101.
      {
 102.
              print("GameModeExit()");
 103.
              return 1;
 104.
      }
 105.

 106.
      public OnPlayerConnect(playerid)
 107.
      {
 108.
      PLAYERLIST_authed[playerid]=false;
 109.
                      GameTextForPlayer(playerid,"Hey there, welcome to RPG Mode",2000,1);
 110.
      SendClientMessage(playerid, COLOR_RED, "*** Welcome to Kirk's Real Life Server");
 111.
      SendClientMessage(playerid, COLOR_GREEN, "*** Please register or login!.");
 112.
      SendClientMessage(playerid, COLOR_GREEN, "*** If your a bit unsure, type /help");
 113.
              return 1;
 114.
      }
 115.

 116.
       dcmd_register(playerid,params[]) {
 117.

 118.
          // The command shouldn't work if we already are authed
 119.
          if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
 120.

 121.
          // The command shouldn't work if an account with this
 122.
          // nick already exists
 123.
          if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account already exists, please use '/login password'.");
 124.

 125.
          // Did he forgot the password?
 126.
          if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/register password'");
 127.

 128.
          // We save the money to the accstate
 129.
          if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"Account successfully created. Login with '/login password' now.");
 130.
          return true;
 131.

 132.
       }
 133.

 134.
        dcmd_login(playerid,params[]) {
 135.
      if(IsSpawned[playerid] == 1){
 136.
          // The command shouldn't work if we already are authed
 137.
          if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"*** Already authed.");
 138.

 139.
          // The command shouldn't work if an account with this
 140.
          // nick does not exists
 141.
          if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"*** Account doesn't exist, please use '/register password'.");
 142.

 143.
          // Did he forgot the password?
 144.
          if (strlen(params)==0) return SystemMsg(playerid,"*** Correct usage: '/login password'");
 145.

 146.
          if (udb_CheckLogin(PlayerName(playerid),params)) {
 147.
             // Login was correct
 148.

 149.
             // Following thing is the same like the missing SetPlayerCommand
 150.
             GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
 151.
             GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("pistole"),99999);
 152.
             GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("mitra"),99999);
 153.
                 pistole[playerid] = dUserINT(PlayerName(playerid)).("pistole");
 154.
                 mitra[playerid] = dUserINT(PlayerName(playerid)).("mitra");
 155.
             PLAYERLIST_authed[playerid]=true;
 156.
             return SystemMsg(playerid,"*** Successfully authed!");
 157.
          } else {
 158.
             // Login was incorrect
 159.
             return SystemMsg(playerid,"*** Login failed!");
 160.
          }
 161.
      }else{SystemMsg(playerid,"*** Spawn before logging!"); }
 162.
          return true;
 163.
       }
 164.

 165.
      public OnPlayerDisconnect(playerid)
 166.
      {
 167.
      if (PLAYERLIST_authed[playerid]) {
 168.
           // Was loggedin, so save the data!
 169.
          dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
 170.
          GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("shotgun"),99999);
 171.
             GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("pistole"),99999);
 172.
             GivePlayerWeapon(playerid,dUserINT(PlayerName(playerid)).("mitra"),99999);
 173.
                 shotgun[playerid] = dUserINT(PlayerName(playerid)).("shotgun");
 174.
                 pistole[playerid] = dUserINT(PlayerName(playerid)).("pistole");
 175.
                 mitra[playerid] = dUserINT(PlayerName(playerid)).("mitra");
 176.
        }
 177.
        PLAYERLIST_authed[playerid]=false;
 178.
        return false;
 179.
      }
 180.

 181.
      public OnPlayerSpawn(playerid){
 182.
      IsSpawned[playerid] = 1;
 183.
      GivePlayerWeapon(playerid, 24, 100000);
 184.
      GivePlayerWeapon(playerid, mitra[playerid], 100000);
 185.
      GivePlayerWeapon(playerid, pistole[playerid], 100000);
 186.
      SetPlayerColor(playerid, COLOR_GREEN);
 187.
       GivePlayerMoney(playerid, 5000);
 188.
      }
 189.

 190.
      public OnPlayerDeath(playerid, killerid, reason)
 191.
      {
 192.
              printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
 193.
              return 1;
 194.
      }
 195.

 196.
      public OnVehicleSpawn(vehicleid)
 197.
      {
 198.
              printf("OnVehicleSpawn(%d)", vehicleid);
 199.
              return 1;
 200.

 201.
      }
 202.

 203.
      public OnVehicleDeath(vehicleid, killerid)
 204.
      {
 205.
              printf("OnVehicleDeath(%d, %d)", vehicleid, killerid);
 206.
              return 1;
 207.
      }
 208.

 209.
      public OnPlayerText(playerid)
 210.
      {
 211.
              printf("OnPlayerText(%d)", playerid);
 212.
              return 1;
 213.
      }
 214.

 215.
      public OnPlayerCommandText(playerid, cmdtext[])
 216.
      {
 217.
      new cmd[256];
 218.
      new idx;
 219.
      new victim;
 220.
      new say[256];
 221.
      cmd = strtok(cmdtext, idx);
 222.
         dcmd(login,5,cmdtext); // because login has 5 characters
 223.
         dcmd(register,8,cmdtext); // because register has 8 characters
 224.

 225.
      if (PLAYERLIST_authed[playerid]) {
 226.

 227.
       if(strcmp(cmd, "/lookarsenal", true) == 0) {
 228.
         new mitrastring[256], shotgunstring[256], pistolestring[256], string[256], name[256];
 229.

 230.
                  new tmp[256];
 231.
                      tmp = strtok(cmdtext, idx);
 232.
              victim = strval(tmp);
 233.
                      GetPlayerName(victim, name, 256);
 234.
                  format(shotgunstring, 256, "%s's weapons:", name);
 235.
                  SendClientMessage(playerid, COLOR_RED, string);
 236.
              switch (pistole[victim]) {
 237.
                  case 0:
 238.
                      {
 239.
                  format(pistolestring, 256, "Pistol: Desert.");
 240.
                  SendClientMessage(playerid, COLOR_RED, pistolestring);
 241.
                      }
 242.
                  case 22:
 243.
                      {
 244.
                  format(pistolestring, 256, "Pistol: Double Pistols.");
 245.
                  SendClientMessage(playerid, COLOR_RED, pistolestring);
 246.
                      }
 247.
      }
 248.
              switch (shotgun[victim]) {
 249.
                  case 0:
 250.
                      {
 251.
                  format(shotgunstring, 256, "Shotgun: None.");
 252.
                  SendClientMessage(playerid, COLOR_RED, shotgunstring);
 253.
                      }
 254.
                  case 25:
 255.
                      {
 256.
                  format(shotgunstring, 256, "Shotgun: Shotgun.");
 257.
                  SendClientMessage(playerid, COLOR_RED, shotgunstring);
 258.
                      }
 259.
                  case 27:
 260.
                      {
 261.
                  format(shotgunstring, 256, "Shotgun: Spaz 12.");
 262.
                  SendClientMessage(playerid, COLOR_RED, shotgunstring);
 263.
                      }
 264.
      }
 265.
              switch (mitra[victim]) {
 266.
              case 0:
 267.
                      {
 268.
                  format(mitrastring, 256, "Rifle: None.");
 269.
                  SendClientMessage(playerid, COLOR_RED, mitrastring);
 270.
                      }
 271.
                  case 30:
 272.
                      {
 273.
                  format(mitrastring, 256, "Rifle: AK-47.");
 274.
                  SendClientMessage(playerid, COLOR_RED, mitrastring);
 275.
                      }
 276.
                  case 29:
 277.
                      {
 278.
                  format(mitrastring, 256, "Rifle: Mp5.");
 279.
                  SendClientMessage(playerid, COLOR_RED, mitrastring);
 280.
                      }
 281.
      }
 282.
          return true;
 283.

 284.
       }
 285.

 286.
            if(strcmp(cmd, "/help", true) == 0) {
 287.
      SendClientMessage(playerid, #define COLOR_RED 0xAA3333AA, "*** Welcome into RPG mode by TommyLR");
 288.
      SendClientMessage(playerid, #define COLOR_GREEN 0x33AA33AA, "*** Command list:");
 289.
      SendClientMessage(playerid, #define COLOR_GREEN 0x33AA33AA, "*** /help /login /register");
 290.
      SendClientMessage(playerid, #define COLOR_GREEN 0x33AA33AA, "*** /loco");
 291.
          return 1;
 292.
          }
 293.

 294.
            if(strcmp(cmd, "/loco", true) == 0) {
 295.
                        SendClientMessage(playerid, COLOR_GREEN, "*** GloboLoco");
 296.
                        checkpoint[playerid] = AUTOLOCO;
 297.
                        SetPlayerCheckpoint(playerid,2644.6550,-2003.5380,13.1840,4);
 298.
                    return 1;
 299.
          }
 300.
      //car locking code copied from Allan.
 301.
              if (strcmp(cmdtext, "/lock", true)==0)
 302.
                      {
 303.
                              if(IsPlayerInAnyVehicle(playerid))
 304.
                              {
 305.
                                      new State=GetPlayerState(playerid);
 306.
                                      if(State!=PLAYER_STATE_DRIVER)
 307.
                                      {
 308.
                                              SendClientMessage(playerid,0xFFFF00AA,"You can only lock the doors as the driver.");
 309.
                                              return 1;
 310.
                                      }
 311.
                                      new i;
 312.
                                      for(i=0;i<MAX_PLAYERS;i++)
 313.
                                      {
 314.
                                              if(i != playerid)
 315.
                                              {
 316.
                                                      SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
 317.
                                              }
 318.
                                      }
 319.
                                      SendClientMessage(playerid, 0xFFFF00AA, "Vehicle locked!");
 320.
                              new Float:pX, Float:pY, Float:pZ;
 321.
                                      GetPlayerPos(playerid,pX,pY,pZ);
 322.
                                      PlayerPlaySound(playerid,1056,pX,pY,pZ);
 323.
                              }
 324.
                              else
 325.
                              {
 326.
                                      SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
 327.
                              }
 328.
                      return 1;
 329.
                      }
 330.

 331.

 332.
      if (strcmp(cmdtext, "/unlock", true)==0)
 333.
              {
 334.
                      if(IsPlayerInAnyVehicle(playerid))
 335.
                      {
 336.
                              new State=GetPlayerState(playerid);
 337.
                              if(State!=PLAYER_STATE_DRIVER)
 338.
                              {
 339.
                                      SendClientMessage(playerid,0xFFFF00AA,"You can only unlock the doors as the driver.");
 340.
                                      return 1;
 341.
                              }
 342.
                              new i;
 343.
                              for(i=0;i<MAX_PLAYERS;i++)
 344.
                              {
 345.
                                      SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
 346.
                              }
 347.
                              SendClientMessage(playerid, 0xFFFF00AA, "Vehicle unlocked!");
 348.
                              new Float:pX, Float:pY, Float:pZ;
 349.
                              GetPlayerPos(playerid,pX,pY,pZ);
 350.
                              PlayerPlaySound(playerid,1057,pX,pY,pZ);
 351.
                      }
 352.
                      else
 353.
                      {
 354.
                              SendClientMessage(playerid, 0xFFFF00AA, "You're not in a vehicle!");
 355.
                      }
 356.
              return 1;
 357.
              }
 358.
          }
 359.
      }else{
 360.
      SendClientMessage(playerid, COLOR_GREEN, "*** Login or register now.");
 361.
      }
 362.
      return false;
 363.
      }
 364.

 365.
      public OnPlayerInfoChange(playerid)
 366.
      {
 367.
              printf("OnPlayerInfoChange(%d)");
 368.
              return 1;
 369.
      }
 370.

 371.
      public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
 372.
      {
 373.
              printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
 374.
              return 1;
 375.
      }
 376.

 377.
      public OnPlayerExitVehicle(playerid, vehicleid)
 378.
      {
 379.
              printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
 380.
              return 1;
 381.
      }
 382.

 383.
      public OnPlayerStateChange(playerid, newstate, oldstate)
 384.
      {
 385.
              printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
 386.
              return 1;
 387.
      }
 388.

 389.
      public OnPlayerEnterCheckpoint(playerid)
 390.
      {
 391.
              printf("OnPlayerEnterCheckpoint(%d)", playerid);
 392.
              switch (checkpoint[playerid]) {
 393.
              case AUTOLOCO:
 394.
              if(wantedlevel[playerid] >= 0){
 395.
              DisablePlayerCheckpoint(playerid);
 396.
                     SendClientMessage(playerid, COLOR_RED, "*** Welcome into AutoLoco Lowrider.");
 397.
                      return 1;
 398.
      }
 399.

 400.
      public OnPlayerLeaveCheckpoint(playerid)
 401.
      {
 402.
              printf("OnPlayerLeaveCheckpoint(%d)", playerid);
 403.
              return 1;
 404.
      }