Jail command doesn't show reason. -
itsCody - 15.06.2013
pawn Код:
dcmd_jail(playerid,params[])
{
new string[128];
new ID;
new cmdtime;
new cmdreason[100];
if(sscanf(params,"ui",ID,cmdtime,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /jail [Player ID] [Seconds] [Reason]");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID [%d] is not connected to the server. You cannot jail them.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s[%d] is not spawned. You cannot jail them.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string,sizeof(string),"{FF0000}[ADMIN] {FFFFFF}%s[%d] has jailed %s[%d] for %d seconds. Reason: %s.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdtime,cmdreason);
SendClientMessageToAll(COLOR_WHITE,string);
Can you help me?
Re: Jail command doesn't show reason. -
FunnyBear - 15.06.2013
Try
pawn Код:
cmd_jail(playerid,params[])
{
new string[128];
new ID;
new cmdtime;
new cmdreason[100];
if(sscanf(params,"ui",ID,cmdtime,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /jail [Player ID] [Seconds] [Reason]");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID [%d] is not connected to the server. You cannot jail them.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s[%d] is not spawned. You cannot jail them.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string,sizeof(string),"{FF0000}[ADMIN] {FFFFFF}%s[%d] has jailed %s[%d] for %d seconds. Reason: %s.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdtime,cmdreason);
SendClientMessageToAll(COLOR_WHITE,string);
return 1;
}
AW: Jail command doesn't show reason. -
HurtLocker - 15.06.2013
if (sscanf(params,"ui
s[100]", ID, cmdtime, cmdreason))
Re: Jail command doesn't show reason. -
Ballu Miaa - 15.06.2013
This should work.
pawn Код:
dcmd_jail(playerid,params[])
{
new string[256],ID,cmdtime,cmdreason[100];// Using 256 as you are displaying lot of things in a ClientMessage. Lower it according to your needs.
if(sscanf(params,"uis[99]",ID,cmdtime,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /jail [playerid/partofname] [Seconds] [Reason]");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"ID [%d] is not connected to the server. Please recheck the ID.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s[%d] is not spawned yet. You cannot jail them.");
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string,sizeof(string),"{FF0000}[ADMIN] {FFFFFF}%s[%d] has jailed %s[%d] for %d seconds. Reason: %s.",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdtime,cmdreason);
SendClientMessageToAll(COLOR_WHITE,string);
return 1;
}
Re: Jail command doesn't show reason. -
itsCody - 16.06.2013
They both worked fine, thanks!