na verdade vocк pode usar sscanf com strcmp...
PHP код:
new
PresoTimer[MAX_PLAYERS],
PresoTempo[MAX_PLAYERS],
bool:Preso[MAX_PLAYERS],
CountTempo[MAX_PLAYERS]
;
if(strcmp(cmd, "/prenderdm", true) ==0) {
if(IsPlayerAdmin(playerid) || pAdmin[playerid] >=3)
{
new
target,
minutos,
cmdString[128],
aName[MAX_PLAYER_NAME],
pName[MAX_PLAYER_NAME]
;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, -1, "Use: prenderdm [playerid] [minutos].");
target = strval(tmp);
if(!IsPlayerConnected(target))
return SendClientMessage(playerid, -1, "playerid nгo conectado verifique o id.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, -1, "Use: prenderdm [playerid] [minutos].");
minutos = strval(tmp);
if(minutos < 1 || minutos > 30)
return SendClientMessage(playerid, -1, "Minutos de 1 a 30.");
GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
GetPlayerName(target, pName, MAX_PLAYER_NAME);
format(cmdString, sizeof(cmdString), "O Administrador(a) %s prendeu o jogador(a) %s por ( %d minutos )", aName, pName, minutos);
SendClientMessageToAll(-1, cmdString);
SetPlayerPos(target, 0.0, 0.0, 0.0);
SetPlayerHealth(target, 9999);
Preso[target] = true;
PresoTempo[target] = gettime() + (60 * minutos);
PresoTimer[target] = SetTimerEx("PresoCallback", 60000, true, "i", target);
}
return 1;
}
forward PresoCallback(playerid);
public PresoCallback(playerid) {
if(Preso[playerid] && gettime() < PresoTempo[playerid])
{
new
cmdString[128]
;
CountTempo[playerid] ++;
format(cmdString, sizeof(cmdString), "Vocк esta preso a %s minuto.", CountTempo[playerid]);
SendClientMessage(playerid, -1, cmdString);
}
else
{
Preso[playerid] = false;
PresoTempo[playerid] = CountTempo[playerid] = 0;
KillTimer(PresoTimer[playerid);
SetPlayerPos(playerid, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, -1, "Vocк foi solto, nгo cometa mais crimes.");
}
return 1;
}