SHARE
TWEET

[FS] FilterScript Veículos Vip Jim xD

Chip7 Sep 10th, 2012 409 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*VISITE NOSSO SITE: http://www.sampknd.com/
  2.   VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
  3.   SAMP KND MELHOR BLOG DE SAMP DO BRASIL
  4. */  
  5.  
  6. #include <a_samp>
  7.  
  8. new
  9.         Modelo[MAX_PLAYERS]
  10. ;
  11. new
  12.         g_string[128]
  13. ;
  14. new
  15.     Float:PlayerGetPos[3]
  16. ;
  17. new
  18.         VeiculoID[MAX_PLAYERS]
  19. ;
  20. new
  21.     Text3D:VLabel3D[MAX_PLAYERS]
  22. ;
  23. new
  24.     bool:CriouVeiculo[MAX_PLAYERS]
  25. ;
  26.  
  27. enum veiculospp
  28. {
  29.         Nome[20]
  30. }
  31. new Veiculopp[MAX_VEHICLES][veiculospp];
  32.  
  33. new Veiculos[212][] =
  34. {
  35.         {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},{"Firetruck"},{"Trashmaster"},
  36.         {"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},
  37.         {"Esperanto"},{"Taxi"},{"Washington"},{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},
  38.         {"Securicar"},{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},{"Coach"},
  39.         {"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},{"Admiral"},{"Squalo"},{"Seasparrow"},
  40.         {"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},{"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},
  41.         {"Berkley's RC Van"},{"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  42.         {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},{"Rustler"},{"ZR-350"},{"Walton"},
  43.         {"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},{"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},
  44.         {"FBI Rancher"},{"Virgo"},{"Greenwood"},{"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},
  45.         {"Benson"},{"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},{"Super GT"},
  46.         {"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},{"Tanker"},{"Roadtrain"},{"Nebula"},
  47.         {"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},
  48.         {"Cadrona"},{"FBI Truck"},{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},{"Blade"},
  49.         {"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},{"Firetruck LA"},{"Hustler"},{"Intruder"},
  50.         {"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},
  51.         {"Uranus"},{"Jester"},{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},{"Bandito"},
  52.         {"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},
  53.         {"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},
  54.         {"Freight Carriage"},{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  55.         {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},{"Sadler"},
  56.         {"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},{"Utility Trailer"}
  57. };
  58.  
  59. public OnPlayerConnect(playerid)
  60. {
  61.         VeiculoID[playerid] = -1;
  62.         CriouVeiculo[playerid] = false;
  63.         return 1;
  64. }
  65.  
  66. public OnPlayerDisconnect(playerid, reason)
  67. {
  68.         DestroyVehicle(VeiculoID[playerid]);
  69.         VeiculoID[playerid] = -1;
  70.         CriouVeiculo[playerid] = false;
  71.         return 1;
  72. }
  73.  
  74. public OnPlayerCommandText(playerid, cmdtext[])
  75. {
  76.         new
  77.                 cmd[128], idx, tmp[128];
  78.  
  79.         cmd = strtok(cmdtext, idx);
  80.        
  81.         GetPlayerPos(playerid, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]);
  82.         new
  83.                 Float:iAngulo
  84.         ;
  85.         GetPlayerFacingAngle(playerid, iAngulo);
  86.  
  87.         if(strcmp(cmd, "/veh", true) == 0 || strcmp(cmd, "/criarveiculo", true) == 0)
  88.         {
  89.                 tmp = strtok(cmdtext, idx);
  90.                 if(!strlen(tmp))
  91.                 {
  92.                     SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veículo ID / Nome] [Cor 1] [Cor 2]");
  93.                         return 1;
  94.                 }
  95.                 new veiculo = GetVehicleModelID(tmp);
  96.                 if(veiculo == -1)
  97.                 {
  98.                         veiculo = strval(tmp);
  99.                 if(veiculo < 400 || veiculo > 611)
  100.                 {
  101.                                 SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veículo ID / Nome] [Cor 1] [Cor 2]");
  102.                                 return 1;
  103.                         }
  104.                 }
  105.                 tmp = strtok(cmdtext, idx);
  106.                 if(!strlen(tmp))
  107.                 {
  108.                     SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veículo ID / Nome] [Cor 1] [Cor 2]");
  109.                         return 1;
  110.                 }
  111.                 new color1 = strval(tmp);
  112.                 tmp = strtok(cmdtext, idx);
  113.                 if(!strlen(tmp))
  114.                 {
  115.                     SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Uso correto: /CriarVeiculo [Veículo ID / Nome] [Cor 1] [Cor 2]");
  116.                         return 1;
  117.                 }
  118.                 new color2 = strval(tmp);
  119.                 if(veiculo < 400 || veiculo > 611)
  120.                 {
  121.                     SendClientMessage(playerid, 0xFF3300AA, "| ERRO | Somente veículos entre 400 á 611!");
  122.                         return 1;
  123.                 }
  124.                 DestroyVehicle(VeiculoID[playerid]);
  125.                 PutPlayerInVehicle(playerid, Modelo[ playerid ] = CreateVehicle(veiculo, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2], iAngulo, color1, color2, -1), 0);
  126.                 VeiculoID[playerid] = GetPlayerVehicleID(playerid);
  127.                 CriouVeiculo[playerid] = true;
  128.                 format(g_string, sizeof(g_string), "| INFO | %s criado com sucesso! (Somente você pode dirigi-lo)", Veiculos[GetVehicleModel(Modelo[ playerid ])-400]);
  129.                 SendClientMessage(playerid, 0xFFFF33AA, g_string);
  130.                 format(g_string, sizeof(g_string), "%s [%d]", PlayerName(playerid), playerid);
  131.                 VLabel3D[playerid] = Create3DTextLabel(g_string, 0x00FF00AA, 0.0, 0.0, 0.0, 40.0, 0, 1);
  132.                 Attach3DTextLabelToVehicle(VLabel3D[playerid], Modelo[ playerid ], 0.0, -2.5, 0.5);
  133.         format(Veiculopp[VeiculoID[playerid]][Nome], 20, PlayerName(playerid));
  134.                 return 1;
  135.         }
  136.         if(strcmp(cmd, "/vehtrazer", true) == 0)
  137.         {
  138.             if(CriouVeiculo[playerid] == true)
  139.             {
  140.                     SendClientMessage(playerid, 0xCCFF33AA, "| INFO | Você trouxe seu veículo até você.");
  141.                         GetPlayerPos(playerid, PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]);
  142.                     SetVehiclePos(VeiculoID[playerid], PlayerGetPos[0], PlayerGetPos[1], PlayerGetPos[2]+1);
  143.                     SetVehicleZAngle(VeiculoID[playerid], iAngulo);
  144.                     PutPlayerInVehicle(playerid, VeiculoID[playerid], 0);
  145.                     return 1;
  146.                 }
  147.                 else
  148.                 {
  149.                     SendClientMessage(playerid, 0xFF6633AA, "| ERRO | Você não criou um veículo próprio para você!");
  150.                     return 1;
  151.                 }
  152.         }
  153.         return 0;
  154. }
  155.  
  156. public OnPlayerExitVehicle(playerid, vehicleid)
  157. {
  158.         if(GetPlayerVehicleID(playerid) == VeiculoID[playerid])
  159.         {
  160.             if(strcmp(Veiculopp[GetPlayerVehicleID(playerid)][Nome], PlayerName(playerid), true) == 0)
  161.             {
  162.                 format(g_string, sizeof(g_string), "%s [%d]", PlayerName(playerid), playerid);
  163.                 Update3DTextLabelText(VLabel3D[playerid], -1, g_string);
  164.             }
  165.         }
  166.         return 1;
  167. }
  168.  
  169. public OnPlayerStateChange(playerid, newstate, oldstate)
  170. {
  171.         if(newstate == PLAYER_STATE_DRIVER)
  172.         {
  173.         if(strcmp(Veiculopp[GetPlayerVehicleID(playerid)][Nome], PlayerName(playerid), false))
  174.                 {
  175.                         format(g_string, sizeof(g_string), "| ERRO | Veículo próprio do(a) %s somente ele(a) pode dirigi-lo!", Veiculopp[GetPlayerVehicleID(playerid)][Nome]);
  176.                         SendClientMessage(playerid, 0xFF6633AA, g_string);
  177.                 PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
  178.                         RemovePlayerFromVehicle(playerid);
  179.                 }
  180.                 else
  181.                 {
  182.                     Update3DTextLabelText(VLabel3D[playerid], -1, "  ");
  183.                 }
  184.                 return 1;
  185.         }
  186.         return 1;
  187. }
  188.  
  189. stock strtok(const string[], &index)
  190. {
  191.         new length = strlen(string);
  192.         while ((index < length) && (string[index] <= ' '))
  193.         {
  194.                 index++;
  195.         }
  196.  
  197.         new offset = index;
  198.         new result[20];
  199.         while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  200.         {
  201.                 result[index - offset] = string[index];
  202.                 index++;
  203.         }
  204.         result[index - offset] = EOS;
  205.         return result;
  206. }
  207.  
  208. stock GetVehicleModelID(nome[])
  209. {
  210.         for(new i = 0; i < 211; ++i)
  211.         {
  212.                 if(strfind(Veiculos[i], nome, true) != -1) return i + 400;
  213.         }
  214.         return -1;
  215. }
  216.  
  217. stock PlayerName(playerid)
  218. {
  219.         new
  220.                 PvName[MAX_PLAYER_NAME+1]
  221.         ;
  222.         GetPlayerName(playerid, PvName, sizeof(PvName));
  223.         return PvName;
  224. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top