Command every 1 minute
#1

how to make that player can use this command every 1 minute?

Код:
CMD:flip(playerid, params[])
{
	new currentveh, Float:angle; currentveh = GetPlayerVehicleID(playerid);
	if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
	else if(PlayerInfo[playerid][VIP] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
    GetVehicleZAngle(currentveh, angle);
	SetVehicleZAngle(currentveh, angle);
	GameTextForPlayer(playerid, "~g~Preokrenuto", 2000, 5);
	return 1;
}
Reply
#2

Use GetTickCount()
Reply
#3

You could use either a timer or GetTickCount. GetTickCount is probably easier but it has issues with servers that are up longer than 24 days at a time.

Using GetTickCount
pawn Код:
new fliptime[MAX_PLAYERS];
CMD:flip(playerid, params[])
{
    new currentveh, Float:angle; currentveh = GetPlayerVehicleID(playerid);
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
    else if(PlayerInfo[playerid][VIP] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
        else if((GetTickCount() - 60000) > fliptime[playerid]) return SendClientMessage(playerid, COLOR_WHITE, "You can only flip once a minute..");
        GetVehicleZAngle(currentveh, angle);
    SetVehicleZAngle(currentveh, angle);
    GameTextForPlayer(playerid, "~g~Preokrenuto", 2000, 5);
        fliptime[playerid] = GetTickCount();
    return 1;
}
Using a timer

pawn Код:
new bool:fliptime[MAX_PLAYERS char];
CMD:flip(playerid, params[])
{
    new currentveh, Float:angle; currentveh = GetPlayerVehicleID(playerid);
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
    else if(PlayerInfo[playerid][VIP] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Samo Admini i V.I.P igraci");
        else if(fliptime{playerid} == true) return SendClientMessage(playerid, COLOR_WHITE, "You can only flip once a minute..");
        GetVehicleZAngle(currentveh, angle);
    SetVehicleZAngle(currentveh, angle);
    GameTextForPlayer(playerid, "~g~Preokrenuto", 2000, 5);
        fliptime{playerid} = true;
    SetTimerEx("resetflip", 60000, false, "d", playerid);
        return 1;
}

forward resetflip(playerid);
public resetflip(playerid)
{
    fliptime{playerid} = false;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)