Advertisement
Guest User

Vehicle Creator

a guest
Oct 28th, 2010
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.42 KB | None | 0 0
  1. /*
  2.  *  Vehicle Creator By KevinsL
  3.  *
  4.  *  Acesse: www.MundoSAMP.net / www.BrasilRealLife.com
  5.  *  Favor não retirar os creditos!
  6.  *  Creditos a KevinsL
  7. */
  8.  
  9. #include <a_samp>
  10. #define FILTERSCRIPT
  11. new carroagora;
  12.  
  13. strtok(const string[], &index)
  14. {
  15.     new length = strlen(string);
  16.     while ((index < length) && (string[index] <= ' '))
  17.     {
  18.         index++;
  19.     }
  20.  
  21.     new offset = index;
  22.     new result[20];
  23.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  24.     {
  25.         result[index - offset] = string[index];
  26.         index++;
  27.     }
  28.     result[index - offset] = EOS;
  29.     return result;
  30. }
  31.  
  32. public OnFilterScriptInit()
  33. {
  34.     print("\n----------------------------------");
  35.     print(" Vehicle Creator by KevinsL Loaded");
  36.     print("-----------------------------------\n");
  37.     return 1;
  38. }
  39.  
  40. public OnFilterScriptExit()
  41. {
  42.     print("\n----------------------------------");
  43.     print(" Vehicle Creator by KevinsL Unloaded");
  44.     print("-----------------------------------\n");
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerRequestClass(playerid, classid)
  49. {
  50.     return 1;
  51. }
  52.  
  53. public OnPlayerConnect(playerid)
  54. {
  55.     SendClientMessage(playerid, 0xFF0000AA, "Vehicle Creator by KevinsL Loaded!");
  56.     return 1;
  57. }
  58.  
  59. public OnPlayerDisconnect(playerid, reason)
  60. {
  61.     return 1;
  62. }
  63.  
  64. public OnPlayerSpawn(playerid)
  65. {
  66.     return 1;
  67. }
  68.  
  69. public OnPlayerDeath(playerid, killerid, reason)
  70. {
  71.     return 1;
  72. }
  73.  
  74. public OnVehicleSpawn(vehicleid)
  75. {
  76.     return 1;
  77. }
  78.  
  79. public OnVehicleDeath(vehicleid, killerid)
  80. {
  81.     return 1;
  82. }
  83.  
  84. public OnPlayerText(playerid, text[])
  85. {
  86.     return 1;
  87. }
  88.  
  89. public OnPlayerCommandText(playerid, cmdtext[])
  90. {
  91.     new cmd[128], idx, tmp[256];
  92.     cmd = strtok(cmdtext, idx);
  93.  
  94.     if(strcmp(cmd, "/criarveiculo", true)==0 || strcmp(cmd, "/cv", true)==0 || strcmp(cmd, "/criarv", true)==0)
  95.     {
  96.         new modelo, cor1, cor2;
  97.         tmp = strtok(cmdtext, idx);
  98.         if(!strlen(tmp)){
  99.             SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: /criarveiculo [modelo] [cor 1] [cor 2]");
  100.             return 1;
  101.         }
  102.         modelo = strval(tmp);
  103.         tmp = strtok(cmdtext, idx);
  104.         if(!strlen(tmp)) {
  105.             SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: /criarveiculo [modelo] [cor 1] [cor 2]");
  106.             return 1;
  107.         }
  108.         cor1 = strval(tmp);
  109.         tmp = strtok(cmdtext, idx);
  110.         if(!strlen(tmp)) {
  111.             SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: /criarveiculo [modelo] [cor 1] [cor 2]");
  112.             return 1;
  113.         }
  114.         cor2 = strval(tmp);
  115.         if(modelo >= 400 && modelo <= 611)
  116.         {
  117.             new stringsalvo[256];
  118.             new Float:X, Float:Y, Float:Z, Float:Rotation;
  119.            
  120.             GetPlayerPos(playerid, X, Y, Z);
  121.             if(IsPlayerInAnyVehicle(playerid))
  122.             {
  123.                 carroagora = GetPlayerVehicleID(playerid);
  124.                 GetVehicleZAngle(carroagora, Rotation);
  125.             }
  126.             else
  127.             {
  128.                 GetPlayerFacingAngle(playerid, Rotation);
  129.             }
  130.            
  131.             new File:pos=fopen("carros.txt", io_append);
  132.             format(stringsalvo, 256, "AddStaticVehicleEx(%d,%f,%f,%f,%f,%d,%d,600000); \n", modelo, X, Y, Z,Rotation,cor1,cor2);
  133.             fwrite(pos, stringsalvo);
  134.             print(stringsalvo);
  135.             SendClientMessage(playerid, 0xFF0000AA, stringsalvo);
  136.             fclose(pos);
  137.         }
  138.         else
  139.         {
  140.             SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: Somente veiculos de 400 a 611!");
  141.         }
  142.         return 1;
  143.     }
  144.  
  145.     if(strcmp(cmdtext, "/ajudavc", true)==0)
  146.     {
  147.         SendClientMessage(playerid, 0xFFFFFFAA, "Use: /criarveiculo [modelo] [cor 1] [cor 2]  e crie um veiculo onde você está! o arquivo será salvo na pasta: scriptfiles");
  148.         return 1;
  149.     }
  150.  
  151.     return 0;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement