new smaterials[MAX_PLAYERS] = 0;
new isabletoscrap[MAX_PLAYERS] = 1;
forward scrapTimer(playerid);
public scrapTimer(playerid)
{
new scrapvehicle = GetPlayerVehicleID(playerid);
smaterials[playerid] += 40;
SendClientMessage(playerid,0x03D687FF,"You scrapped a car for 40 materials!");
SetTimerEx("waitscrapTimer", 900000, false, "i", playerid);
SendClientMessage(playerid,0x03D687FF,"You can scrap again in 15 minutes!");
TogglePlayerControllable(playerid,1);
SetVehicleToRespawn(scrapvehicle);
isabletoscrap[playerid] = 0;
}
forward waitscrapTimer(playerid);
public waitscrapTimer(playerid)
{
SendClientMessage(playerid,COLOR_GREEN,"You can now scrap again!");
isabletoscrap[playerid] = 1;
}
CMD:scrapcar(playerid, params[])
{
new scrapvehicle = GetPlayerVehicleID(playerid);
if(GetVehicleModel(scrapvehicle) == 604 || GetVehicleModel(scrapvehicle) == 605)
{
if (isabletoscrap[playerid] == 0) return SendClientMessage(playerid,0x03D687FF,"You can scrap again after 15 minutes have passed!");
if(IsPlayerInRangeOfPoint(playerid, 10.0, 4.1837700,1345.4106400,8.5145000))
{
SendClientMessage(playerid, 0xC9FF78FF, "You have started scrapping your vehicle, please wait 10 seconds..");
//SetTimer("scrapTimer", 6000, false);
SetTimerEx("scrapTimer", 10000, false, "i", playerid);
SetVehicleToRespawn(scrapvehicle);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,0);
}
else return SendClientMessage(playerid,COLOR_RED,"You aren't near the /scrapcar checkpoint!");
}
else return SendClientMessage(playerid,COLOR_RED,"You must be in a scrappable vehicle! ((Broken Sadler and Broken Glendale))");
return 1;
}
new timer[MAX_PLAYERS];//for all players
timer[playerid] = SetTimerEx(.......);
|
Use variables for timers: at top: Code: new timer[MAX_PLAYERS];//for all players and when you start the timer, use Code: timer[playerid] = SetTimerEx(.......); |