26.08.2018, 16:44
So, i made a warrant system for my server. If player doesn't have a driving license and he drives a vehicle, he'll get a wanted level:
Everything works, but as you can see, i set pvars to prevent adding a wanted level everytime a player exits/enters the vehicle.
It's a 1 minute cooldown, means if the player got already the wanted level for driving without license and he tries to re-enter another vehicle in less than 1 minute, he'll not get wanted level again.
But doesn't work, what's wrong? Probably added in wrong place the pvars?
pawn Код:
if (IsDoorVehicle(vehicleid))
{
switch (Player[playerid][VehicleLicense])
{
case 0:
{
SCM(playerid, COLOR_LIGHTRED, "* Commited a crime: (Vehicle theft | Driving without a valid driving license) - Your wanted level has been increased.");
SetPlayerWantedLevelEx(playerid, GetPlayerWantedLevel(playerid)+1);
format(string,sizeof(string),"* [Law Enforcement Radio]: Vehicle theft without license (%s) by %s (%d) - Zone: %s", ReturnVehicleName(vehicleid), ReturnPlayerName(playerid), playerid, zone);
SendMessageToCops(string);
}
case 1:
{
SCM(playerid, COLOR_LIGHTRED, "* Commited a crime: (Vehicle Theft) - Your wanted level has been increased.");
SetPlayerWantedLevelEx(playerid, GetPlayerWantedLevel(playerid)+1);
format(string,sizeof(string),"* [Law Enforcement Radio]: Vehicle theft (%s) by %s (%d) - Zone: %s", ReturnVehicleName(vehicleid), ReturnPlayerName(playerid), playerid, zone);
SendMessageToCops(string);
}
}
SetPVarInt(playerid,"WarrantTime",GetTickCount()+60000);
if(GetPVarInt(playerid,"WarrantTime")>GetTickCount()) return 0;
}
It's a 1 minute cooldown, means if the player got already the wanted level for driving without license and he tries to re-enter another vehicle in less than 1 minute, he'll not get wanted level again.
But doesn't work, what's wrong? Probably added in wrong place the pvars?