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;
}
Pvars are useful for me. I use them alot in my gamemode, they're better than normal timers.
|
if(GetPVarInt(playerid,"WarrantTime")>GetTickCount()) return 0;
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);
SetPVarInt(playerid,"WarrantTime",GetTickCount()+60000);
}
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);
}
}
error 002: only a single statement (or expression) can follow each "case" |
if(GetPVarInt(playerid,"WarrantTime")>GetTickCount()) return 0;
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);
SetPVarInt(playerid,"WarrantTime",GetTickCount()+60000);
}
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);
}
}