command just returning ++REP -
canip0000 - 09.07.2016
pawn Код:
CMD:jail(playerid, params[])
{
if(IsPlayerAdmin(playerid)) // if is admin player
{
new reason[36];
if(sscanf(params, "uis[100]", params[0], params[1], reason)) return SendClientMessage(playerid, -1, "usage: /jail [playerid] [time] [reason]");
if(jailed[params[0]][player_jailed] != true) // The player jailed not is already jailed
{
if(params[1] >= 10)
{
if(strlen(reason) >= 3 && strlen(reason) < 36) // The reason is valid, 3 - 35 charactes
{
new INI:File = INI_Open(players_jailed(params[0])); // save data jailed
INI_SetTag(File, "Information Jail");
INI_WriteString(File, "Admin", Name(playerid));
INI_WriteString(File, "Reason", reason);
INI_WriteInt(File, "Time", params[1]*1);
INI_Close(File);
new i_admin[24];
GetPlayerName(playerid, i_admin, 24);
jailed[params[0]][administrator] = i_admin;
jailed[params[0]][time_jailed] = params[1]*1;
jailed[params[0]][reason_jailed] = reason;
jailed[params[0]][player_jailed] = true;
defer animation_jail(params[0]);
defer timer_jail(params[0]);
new string[156];
format(string, sizeof(string), "** %s has been jailed %d seconds by administrator %s. reason: %s", Name(params[0]), params[1]*1, Name(playerid), reason);
SendClientMessageToAll(-1, string);
}
else
{
SendClientMessage(playerid, -1, "Reason incorrect, mнn 3 characters, max 35");
}
}
else
{
SendClientMessage(playerid, -1, "Time incorrect, min 10 seconds");
}
}
else
{
SendClientMessage(playerid, -1, "The player that you have entered is already in prison");
}
}
else
{
SendClientMessage(playerid, -1, "You need to be administrator(rcon) to use this command");
}
return 1;
}
Hello, when i try use the command, i just shows me this IG usage: /jail [playerid] [time] [reason]
Re: command just returning ++REP -
Dusan01 - 09.07.2016
Mhm, try replacing ur code with this:
PHP код:
if(sscanf(params, "uis[35]", params[0], params[1], reason)) return SendClientMessage(playerid, -1, "usage: /jail [playerid] [time] [reason]");
Re: command just returning ++REP -
canip0000 - 09.07.2016
Not working?
Re: command just returning ++REP -
Dusan01 - 09.07.2016
Quote:
Originally Posted by canip0000
Not working?
|
mhm, try updating your sscanf then...
Re: command just returning ++REP -
Vince - 09.07.2016
Sometimes I really don't understand what the aversion to variables is. Instead of using "params[0]" and "params[1]", actually create two variables "targetid" and "jailTime". Readability should always take precedence over anything else. Plus, accessing an array index is actually slower than accessing a normal variable.
Re: command just returning ++REP -
canip0000 - 09.07.2016
Updated plugin, but still same issue? :/
Re: command just returning ++REP -
canip0000 - 09.07.2016
Tried running it as Filterscript. And that worked, but it doesn't work in the gamemode?