• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Timer
#1
Im trying to make /mute command, but i dont know how to set timer which is equal to time which i set in command and when this timer ends it sets to player stats Muted = 0



Code:
CMD:mute(playerid, params[])

{

if (!IsPlayerAdmin(playerid) || PlayerInfo [playerid] [pAdmin] < 1) return SendClientMessage(playerid, COLOR_SERVER, "[BC:RP] {FFFFFF}Niste admin.");

if (IsPlayerAdmin(playerid) || PlayerInfo [playerid] [pAdmin] > 0)

{

new id, reason[128], str[128], string[256], pName[MAX_PLAYER_NAME], pMutedName[MAX_PLAYER_NAME], time;

if(sscanf(params, "uis", id, time, reason)) return SendClientMessage(playerid, COLOR_SERVER, "[Usage]: {FFFFFF}/mute [ID/Ime] [Vrijeme] [Razlog]") ;

else if (time < 0 || time > 1000) return SendClientMessage(playerid, COLOR_SERVER, "[Usage]: Vrijeme ne moze biti manje od 0 (skidanje mute-a) i vece od 1000. ");

else if (time == 0) return SendClientMessage(playerid, -1, "Admin vam je skinuo mute.");

GetPlayerName(playerid, pName, sizeof(pName));

GetPlayerName(id, pMutedName, sizeof(pMutedName));

format(str, sizeof(str), "{FF0000}Utisani ste od strane admina {FFFFFF}%s {FF0000} na {FFFFFF}%d {FF0000}minuta. Razlog: {FFFFFF}%s.", pName, time, reason);

SendClientMessage(id, -1, str);

format(string, sizeof(string), "{FF0000}[Mute]: Admin {FFFFFF}%s {FF0000}je utisao igraca {FFFFFF}%s {FF0000}na {FFFFFF}%d {FF0000}minuta. Razlog: {FFFFFF}%s", pName, pMutedName, time, reason);

foreach(Player, i)

if(PlayerInfo [i] [pStaff] == 1)

{

SendClientMessage(i, -1, string);

}

PlayerInfo [id] [pMuted] = time;

PlayerInfo [id] [pMutedReason] = reason;

SetTimerEx("mutetime", time*1000, false, "d", id);





}

return 1;

}
  Reply


Messages In This Thread
Timer - by njoBe_ - 2021-07-30, 08:49 PM
RE: Timer - by Radical - 2021-07-30, 10:19 PM
RE: Timer - by Pinch - 2021-07-31, 12:48 AM
RE: Timer - by Radical - 2021-07-31, 05:50 AM
RE: Timer - by njoBe_ - 2021-07-31, 09:56 AM
RE: Timer - by Pinch - 2021-07-31, 12:34 PM
RE: Timer - by Slade - 2022-01-21, 10:17 PM

Forum Jump: