Help whit jail command - 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 whit jail command (
/showthread.php?tid=567469)
Help whit jail command -
Guss - 14.03.2015
Hi there, i need help whit this command:
PHP код:
new bool:Jailed[MAX_PLAYERS];
PHP код:
dcmd_jail(playerid, params[])
{
new jailedid, time, string[128];
if(sscanf(params, "ud", jailedid, time))
{
SendClientMessage(playerid, -1, "/jail <id> <minutes>");
}
else if(jailedid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not online.");
}
else if(Jailed[jailedid] == true)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Player already jailed.");
}
else
{
SetTimerEx("Unjailtime", 1000 * time, false, "d", jailedid);
format(string, sizeof(string), "%d is jailed", jailedid);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(jailedid, COLOR_RED, "You have been jailed!");
}
return 1;
}
PHP код:
public Unjailtime(playerid)
{
Jailed = false;
SendClientMessage(jailedid, COLOR_GREEN, "You're free!");
SetPlayerPos(jailedid, 1676.9254, 1448.6653, 10.7831);
return 1;
}
And I get these errors:
Код:
(10143) : warning 235: public function lacks forward declaration (symbol "Unjailtime")
(10145) : error 033: array must be indexed (variable "Jailed")
(10146) : error 017: undefined symbol "jailedid"
(10147) : error 017: undefined symbol "jailedid"
I found this code on the forum and I wanted to adapt it to my GameMode help please, regards!!
Re: Help whit jail command -
JeaSon - 14.03.2015
you puted jailed = false; but you defined jailed as player veriable so you need to add jailed[playerid] and in sendclientmessage why did you puted jailedid ? as you already defined playerid which is jailedid so no need to add jaileddid and last thing you didnt forwarded this public
there you go
pawn Код:
forward Unjailtime(playerid);
public Unjailtime(playerid)
{
Jailed[playerid] = false;
SendClientMessage(playerid, COLOR_GREEN, "You're free!");
SetPlayerPos(playerid, 1676.9254, 1448.6653, 10.7831);
return 1;
}
Re: Help whit jail command -
ATGOggy - 14.03.2015
Your code is all wrong.
I fixed it:
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, "ERROR: Player is not online.");
if(Jailed[jailedid] == true) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player already jailed.");
Jailed[playerid]=true;
SetTimerEx("Unjailtime", 60000 * time, false, "d", jailedid);
format(string, sizeof(string), "%d is jailed", jailedid);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(jailedid, COLOR_RED, "You have been jailed!");
return 1;
}
forward Unjailtime(playerid);
public Unjailtime(playerid)
{
Jailed[playerid] = false;
SendClientMessage(playerid, COLOR_GREEN, "You're free!");
SetPlayerPos(playerid, 1676.9254, 1448.6653, 10.7831);
return 1;
}