SHARE
TWEET

Untitled

a guest May 4th, 2008 863 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2.  
  3. new Started[MAX_PLAYERS];
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.         print("\n--------------------------------------");
  8.         print(" Vehicle start & stop by WeeDarr [2008]");
  9.         print("--------------------------------------\n");
  10.         return 1;
  11. }
  12.  
  13. public OnPlayerConnect(playerid)
  14. {
  15.     Started[playerid] = 0;
  16.         return 1;
  17. }
  18.  
  19. public OnPlayerDisconnect(playerid, reason)
  20. {
  21.     Started[playerid] = 0;
  22.         return 1;
  23. }
  24.  
  25. public OnPlayerSpawn(playerid)
  26. {
  27.     Started[playerid] = 0;
  28.         return 1;
  29. }
  30.  
  31. public OnPlayerDeath(playerid, killerid, reason)
  32. {
  33.         Started[playerid] = 0;
  34.         return 1;
  35. }
  36.  
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39.         if (strcmp("/on", cmdtext, true, 3) == 0)
  40.         {
  41.                 if(Started[playerid] == 0)
  42.                 {
  43.                     if(GetPlayerState(playerid) == 2)
  44.                     {
  45.                     SendClientMessage(playerid, 0xAFAFAFAA, "Vehicle started");
  46.                     Started[playerid] = 1;
  47.                     TogglePlayerControllable(playerid, 1);
  48.                     }
  49.                     else
  50.                     {
  51.                     SendClientMessage(playerid, 0xAFAFAFAA, "You need to be the driver of a vehicle.");
  52.                     }
  53.                 }
  54.                 else
  55.                 {
  56.                 SendClientMessage(playerid, 0xAFAFAFAA, "Vehicle already started");
  57.                 }
  58.                 return 1;
  59.         }
  60.        
  61.         if (strcmp("/off", cmdtext, true, 4) == 0)
  62.         {
  63.         if(Started[playerid] == 1)
  64.                 {
  65.                     if(GetPlayerState(playerid) == 2)
  66.                     {
  67.                     SendClientMessage(playerid, 0xAFAFAFAA, "Vehicle off");
  68.                     Started[playerid] = 0;
  69.                     TogglePlayerControllable(playerid, 0);
  70.                     }
  71.                     else
  72.                     {
  73.                     SendClientMessage(playerid, 0xAFAFAFAA, "You need to be the driver of a vehicle.");
  74.                     }
  75.                 }
  76.                 else
  77.                 {
  78.                 SendClientMessage(playerid, 0xAFAFAFAA, "Vehicle already off");
  79.                 }
  80.                 return 1;
  81.         }
  82.         return 0;
  83. }
  84.  
  85. public OnPlayerStateChange(playerid, newstate, oldstate)
  86. {
  87.     if(GetPlayerState(playerid) == 2)
  88.     {
  89.     SendClientMessage(playerid, 0xAFAFAFAA, "Start your vehicle, /go");
  90.     TogglePlayerControllable(playerid, 0);
  91.     }
  92.    
  93.     if(GetPlayerState(playerid) == 1)
  94.     {
  95.     SendClientMessage(playerid, 0xAFAFAFAA, "Ignition off");
  96.     Started[playerid] = 0;
  97.     }
  98.     return 1;
  99. }
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