Advertisement
Nyft_

Veículo motor ~Nyft

Jun 20th, 2021 (edited)
656
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include a_samp
  2. #include pawn.cmd
  3.  
  4. main(){}
  5.  
  6. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  7. {
  8.     if((newkeys & KEY_YES) && GetPlayerVehicleSeat(playerid) == 0 && !IsABicycle(GetPlayerVehicleID(playerid)))
  9.         callcmd::motor(playerid);
  10.  
  11.     return 1;
  12. }
  13.  
  14. public OnPlayerStateChange(playerid, newstate, oldstate)
  15. {
  16.     switch(newstate)
  17.     {
  18.         case PLAYER_STATE_DRIVER:
  19.         {
  20.             if(!IsABicycle(GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(playerid) == 0)
  21.                 SendClientMessage(playerid, -1, "* Pressione Y ou use (/motor) para ligar o veículo.");
  22.         }
  23.     }
  24.     return 1;
  25. }
  26.  
  27. IsABicycle(vehicleid)
  28. {
  29.     switch(GetVehicleModel(vehicleid))
  30.     {
  31.         case 481,509,510:return 1;
  32.     }
  33.     return 0;
  34. }
  35.  
  36. CMD:motor(playerid)
  37. {
  38.     if(IsABicycle(GetPlayerVehicleID(playerid)))
  39.         return SendClientMessage(playerid, -1, "* Você está conduzindo uma bicicleta.");
  40.  
  41.     if(GetPlayerVehicleSeat(playerid) != 0)
  42.         return SendClientMessage(playerid, -1, "* Você não está conduzindo um veículo.");
  43.  
  44.     new string[24], engine, lights, alarm, doors, bonnet, boot, objective;
  45.     GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
  46.     SetVehicleParamsEx(GetPlayerVehicleID(playerid), engine ? VEHICLE_PARAMS_ON : VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
  47.     format(string, sizeof(string), "%s", engine ? "~w~MOTOR ~g~LIGADO!" : "~w~MOTOR ~r~DESLIGADO!");
  48.     GameTextForPlayer(playerid, string, 5000, 3);
  49.     return 1;
  50. }
Advertisement
RAW Paste Data Copied
Advertisement