[HELP] sscanf 2.6 + zcmd -
gilpenner - 11.09.2012
Hello guys..
I've been a long time away from SA:MP and now I'm coming back, but there's lot of modifications, one of those is the sscanf..
Well, I'm trying to make a simple command, /kick but the problem is..
I always get this message.
PHP код:
USAGE: /kick [playerid] [reason]
of course I have on the top of my GM
PHP код:
new string[MAX_PLAYERS][128], iPlayer;
My command is this one;
PHP код:
CMD:kick(playerid, params[]) {
if(AdminLevel(playerid, 1)) return 1;
if(sscanf(params,"us[128]", iPlayer, string[playerid]))
return SendClientMessage(playerid, cinza,"USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(iPlayer))
return ERROR4//Will return a message that the player isn't online
format(string[iPlayer], 128, "%s(%d) was disconnected by %s(%d) reason: %s", gName(iPlayer), iPlayer, gName(playerid), playerid, string[playerid]);
SendClientMessageToAll(red, string[iPlayer]);
Kick(iPlayer);
return true;
}
I'm using the last version of sscanf, I already tried lot of things, still doesn't work, can some help me?
Thank you.
Re: [HELP] sscanf 2.6 + zcmd -
Dokins - 11.09.2012
Try this.
pawn Код:
CMD:kick(playerid, params[])
{
new string[128];
if(AdminLevel(playerid, 1)) return 1;
if(sscanf(params,"us[128]", iPlayer, string[128])
return SendClientMessage(playerid, cinza,"USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(iPlayer))
return ERROR4//Will return a message that the player isn't online
format(string[iPlayer], 128, "%s(%d) was disconnected by %s(%d) reason: %s", gName(iPlayer), iPlayer, gName(playerid), playerid, string[128]);
SendClientMessageToAll(red, string[128]);
Kick(iPlayer);
return true;
}
pawn Код:
new string[MAX_PLAYERS][128]
Two things wrong with that.
1. You're making it available to every player.
2. It has 2 parameters (MAX_PLAYERS), (String (size)).
Re: [HELP] sscanf 2.6 + zcmd -
gilpenner - 11.09.2012
I got a error..
PHP код:
array index out of bounds (variable "string")
I guess I can't put [128]
PHP код:
if(sscanf(params,"us[128]", iPlayer, string/*[128]*/)
Re: [HELP] sscanf 2.6 + zcmd -
gilpenner - 11.09.2012
resolved