08.02.2012, 06:45
im making an /arrest cmd, but i dont know how to pass the time value to the timer, soo heres my code:
pawn Код:
CMD:arrest(playerid, params[])
{
new id, time[120], reason[128];
if(sscanf(params,"uds[128]", id, time, reason)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Use: /arrest [ID] [Time] [Reason]");
{
if(pInfo[playerid][FactionID] == 1)
{
if(IsPlayerInRangeOfPoint(id, 5, 264.0432,86.6674,1001.0391)) // cela 1
{
new name[MAX_PLAYER_NAME], str[256], str2[256];
GetPlayerName(id, name, sizeof(name));
format(str, sizeof(str), "you have been arrested for %d minutes, by the reason: %s", time, reason);
SendClientMessage(id, COLOR_RED, str);
format(str2, sizeof(str2), "You have arrested the player: %s for %d minutes, by the reason: %s", name, time, reason);
SendClientMessage(id, COLOR_RED, str2);
pInfo[id][Njailed] = 1;
LSPDTIMERJAIL[playerid] = SetTimerEx("LSPDTIMERCELL", 1000, false, "d", playerid);
}
else if(IsPlayerInRangeOfPoint(id, 5, 263.9735,82.0618,1001.0391)) // cela 2
{
new name[MAX_PLAYER_NAME], str[256], str2[256];
GetPlayerName(id, name, sizeof(name));
format(str, sizeof(str), "you have been arrested for %d minutes, by the reason: %s", time, reason);
SendClientMessage(id, COLOR_RED, str);
format(str2, sizeof(str2), "You have arrested the player: %s for %d minutes, by the reason: %s", name, time, reason);
SendClientMessage(playerid, COLOR_RED, str2);
pInfo[id][Njailed] = 1;
LSPDTIMERJAIL[playerid] = SetTimerEx("LSPDTIMERCELL2", 1000, false, "d", playerid);
}
}
}
return 1;
}
forward LSPDTIMERCELL(playerid);
forward LSPDTIMERCELL2(playerid);
public LSPDTIMERCELL(playerid)
{
new lspdtimeval = time
lspdtimeval--;
}