Timer help
#1

How i can can put on this command timer and after 2 minutes to can spawn car again


Code:
if (strcmp("/NRG", cmdtext, true, 10) == 0)
    {
    if (PlayerInfo[playerid][pDonateRank] >= 3)
	{
    new Float:X,Float:Y,Float:Z,Float:Angle, carid;
	GetPlayerPos(playerid,X,Y,Z);
	GetPlayerFacingAngle(playerid,Angle);
    carid = GetPlayerVehicleID(playerid);
	carid = CreateVehicle(522,X,Y,Z,Angle,-1,-1,600);
	PutPlayerInVehicle(playerid,carid,0);
	TogglePlayerControllable(playerid,true);
    return SendClientMessage(playerid, 0x40FF40FF, "NRG has been spawned!");
    	 	}
	return 1;
	}
Reply
#2

pawn Code:
if (strcmp("/NRG", cmdtext, true) == 0)
{
    if (PlayerInfo[playerid][pDonateRank] >= 3)
    {
        if(GetTickCount() - GetPVarInt(playerid, "LastNRG") < 120000) return SendClientMessage(playerid, 0xFF0000FF, "You have to wait 2 minutes before spawning new NRG");
        new Float:X,Float:Y,Float:Z,Float:Angle, carid;
        GetPlayerPos(playerid,X,Y,Z);
        GetPlayerFacingAngle(playerid,Angle);
        carid = GetPlayerVehicleID(playerid);
        carid = CreateVehicle(522,X,Y,Z,Angle,-1,-1,600);
        PutPlayerInVehicle(playerid,carid,0);
        TogglePlayerControllable(playerid,true);
        SetPVarInt(playerid, "LastNRG", GetTickCount());
        return SendClientMessage(playerid, 0x40FF40FF, "NRG has been spawned!");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)