Problem with this
#1

Hello,i maked a small limit to vehicles,players must wait 5 seconds each before entering in a vehicle:

OnPlayerStateChange

pawn Код:
if(GetPVarInt(playerid,"VWTIMER")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"You must wait 5 seconds before entering in a vehicle again.");
   SetPVarInt(playerid,"VWTIMER",GetTickCount()+5000);
   RemovePlayerFromVehicle(playerid);
But dont work,what's wrong?
Reply
#2

The problem is that you do not remove the player from the vehicle in any way as you are returning return an error message and thus making everything that comes after it not execute. This is why it is important for your code to have a logical flow.

pawn Код:
if(GetPVarInt(playerid,"VWTIMER")>GetTickCount()) {
    SendClientMessage(playerid,0xFF0000FF,"You must wait 5 seconds before entering in a vehicle again.");
    SetPVarInt(playerid,"VWTIMER",GetTickCount()+5000);
    RemovePlayerFromVehicle(playerid);
    return 1;
}
Reply
#3

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)