Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. public OnPlayerStateChange(playerid, newstate, oldstate)
  2. {
  3.     if(IsPlayerNPC(playerid)) return 1;
  4.     if(playerDB[playerid][vedelogin] == false)
  5.     {
  6.         SendClientMessage(playerid,GREY,"* Serveris: Pirmiausia prisijunkite");
  7.         return 1;
  8.     }
  9.     if(oldstate == PLAYER_STATE_DRIVER)
  10.     {
  11.         GameTextForPlayer(playerid," ",100,5);
  12.     }
  13.     if(newstate == PLAYER_STATE_DRIVER)
  14.     {
  15.         new vehicleid = GetPlayerVehicleID(playerid);
  16.         if(vehicleDB[vehicleid][locked])
  17.         {
  18.             new name[MAX_PLAYER_NAME];
  19.             GetPlayerName(playerid,name,sizeof(name));
  20.             if(strcmp(name,vehicleDB[vehicleid][owner_name],true))
  21.             {
  22.                 new msg[128];
  23.                 format(msg,sizeof(msg),"Mašinos savininkas {347C17}%s",vehicleDB[vehicleid][owner_name]);
  24.                 SendClientMessage(playerid,RED,msg);
  25.                 Stop(playerid);
  26.                 return 1;
  27.             }
  28.             if(!playerDB[playerid][rbool][0])
  29.             {
  30.                 KickEx(playerid);
  31.             }
  32.             playerDB[playerid][rbool][0]=false;
  33.         }
  34.  
  35.         new typ;
  36.         typ = IsAutohausCar(vehicleid);
  37.  
  38.         if(typ!=-1)
  39.         {
  40.             new string[128];
  41.             TogglePlayerControllable(playerid,0);
  42.             Spectating[playerid][0]=typ;
  43.             SetVehicleParamsForAll(vehicleid,0,1);
  44.             SendClientMessage(playerid, COLOR_YELLOW, "~*~ Utenos naudotu auto turgus ~*~");
  45.             format(string,128,"Pavadinimas: %s",Buylist[typ][Name]);
  46.             SendClientMessage(playerid, COLOR_YELLOW, string);
  47.             format(string,128,"Kaina: $%i",Buylist[typ][Price]);
  48.             SendClientMessage(playerid, COLOR_YELLOW, string);
  49.             format(string,128,"Atstatymo kaina: $%i",Buylist[typ][Repair]);
  50.             SendClientMessage(playerid, COLOR_YELLOW, string);
  51.             SendClientMessage(playerid, COLOR_GREEN, "Nori sita pirkti?: /pirkti");
  52.             SendClientMessage(playerid, COLOR_GREEN, "Nenori pirkti?: /islipti");
  53.             SetTimerEx("removcar",5000,0,"i",playerid);
  54.             SendClientMessage(playerid, COLOR_GREEN, "Apsispresti turesi per 5s.!!");
  55.             /*  new msg[256];
  56.             format(msg,sizeof(msg),"~n~ ~r~Modelis:~y~ %s ~n~~r~Kaina: ~y~%i LT~n~~r~Remonto kaina:~y~ %i LT~n~Isigijimui rasykite ~w~/buycar~n~~r~Islipimui        rasykite ~w~/exitcar",Buylist[typ][Name],Buylist[typ][Price],Buylist[typ][Repair]);
  57.             GameTextForPlayer(playerid,msg,30000,3);*/
  58.         }
  59.    
  60.         printf("%d %d", newstate, oldstate);
  61.         if(beingspec[playerid])
  62.         {
  63.             if((oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) && (newstate != PLAYER_STATE_DRIVER && newstate != PLAYER_STATE_PASSENGER))
  64.             {
  65.                 print("pasiektas player");
  66.                 PlayerSpectatePlayer( specid[ playerid ], playerid );
  67.             }
  68.             printf("%d %d", newstate, oldstate);
  69.             else if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER )
  70.             {
  71.                 print("pasiektas vehicle");
  72.                 PlayerSpectateVehicle( specid[ playerid ], GetPlayerVehicleID( playerid ) );
  73.             }
  74.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement