Advertisement
Guest User

gfix

a guest
Jan 30th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.31 KB | None | 0 0
  1. /* credits to Dwayne Pheonix */
  2.  
  3. #include <a_samp>
  4.  
  5. new
  6.     bool:Paused[MAX_PLAYERS],
  7.     LastVeh[MAX_PLAYERS] = -1,
  8.     timer_[MAX_PLAYERS];
  9.  
  10. public OnPlayerConnect(playerid) {
  11.     KillTimer(timer_[playerid]);
  12.     timer_[playerid] = SetTimerEx("Check_", 1007, true, "i", playerid);
  13.     return 1;
  14. }
  15.  
  16. public OnPlayerDisconnect(playerid, reason) {
  17.     KillTimer(timer_[playerid]);
  18.     LastVeh[playerid] = -1;
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerUpdate(playerid) {
  23.     Paused[playerid] = false;
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  28. {
  29.     if((IsValidModel(vehicleid)) && (ispassenger)) LastVeh[playerid] = vehicleid;
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerExitVehicle(playerid, vehicleid)
  34. {
  35.     LastVeh[playerid] = -1;
  36.     return 1;
  37. }
  38.  
  39. native IsValidVehicle(vehicleid);
  40. Check_(playerid); public Check_(playerid) {
  41.     if(Paused[playerid] != false) {
  42.         if(IsValidVehicle(LastVeh[playerid]) && IsValidModel(LastVeh[playerid])) PutPlayerInVehicle(playerid, LastVeh[playerid], 1);
  43.         return 1;
  44.     }
  45.     Paused[playerid] = true;
  46.     return 1;
  47. }
  48.  
  49. IsValidModel(vehicleid) {
  50.     new model_ = GetVehicleModel(vehicleid);
  51.     if( (model_ == 462) || (model_ == 581) || (model_ == 522) || (model_ == 461) || (model_ == 521) ||
  52.     (model_ == 463) || (model_ == 468) || (model_ == 586) || (model_ == 471)) return 1;
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement