Help to remove a parameter - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help to remove a parameter (
/showthread.php?tid=567578)
Help to remove a parameter -
Guss - 15.03.2015
Hi guys, I have this command for sending players to jail:
PHP код:
dcmd_jail(playerid, params[])
{
new jailedid, time, string[128];
if(sscanf(params, "ud", jailedid, time)) return SendClientMessage(playerid, -1, "/jail [id] [minutes]");
if(jailedid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not online.");
if(Jailed[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "The player is already jailed");
Jailed[playerid]=true;
SetTimerEx("Unjailtime", 60000 * time, false, "d", jailedid);
format(string, sizeof(string), "%s has been jailed", GetPlayerNameEx(jailedid));
SendClientMessageToAll(COLOR_RED, string);
SetPlayerPos(jailedid, -27.1455, 2321.1648, 24.3034);
SetPlayerInterior(jailedid, 0);
SendClientMessage(jailedid, COLOR_RED, "YOU ARE JAILED!!");
return 1;
}
I want to remove the parameter "minute" and thus only be "/jail id" for a time of 1 minute fixed.
Here is the rest of the code:
PHP код:
new bool:Jailed[MAX_PLAYERS];
PHP код:
forward Unjailtime(playerid);
public Unjailtime(playerid)
{
new string[128];
Jailed[playerid] = false;
SetPlayerPos(playerid, -20.8889, 2334.4663, 24.1406);
SetPlayerInterior(playerid, 0);
format(string, sizeof(string), "%s is free", GetPlayerNameEx(playerid));
SendClientMessageToAll(COLOR_ORANGE, string);
return 1;
}
Thanks for all the help, regards!
Re: Help to remove a parameter -
X337 - 15.03.2015
Код:
dcmd_jail(playerid, params[])
{
new jailedid, string[128];
if(sscanf(params, "u", jailedid)) return SendClientMessage(playerid, -1, "/jail [id]");
if(jailedid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not online.");
if(Jailed[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "The player is already jailed");
Jailed[playerid]=true;
SetTimerEx("Unjailtime", 60000, false, "d", jailedid);
format(string, sizeof(string), "%s has been jailed", GetPlayerNameEx(jailedid));
SendClientMessageToAll(COLOR_RED, string);
SetPlayerPos(jailedid, -27.1455, 2321.1648, 24.3034);
SetPlayerInterior(jailedid, 0);
SendClientMessage(jailedid, COLOR_RED, "YOU ARE JAILED!!");
return 1;
}
For 1 minutes
Re: Help to remove a parameter -
StreetGT - 15.03.2015
you should read about sscanf and command processors
https://sampwiki.blast.hk/wiki/Fast_Commands