[HELP] sscanf 2.6 + zcmd
#1

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(playeridparams[]) {
    if(
AdminLevel(playerid1)) return 1;
    if(
sscanf(params,"us[128]"iPlayerstring[playerid]))
        return 
SendClientMessage(playeridcinza,"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), iPlayergName(playerid), playeridstring[playerid]);
    
SendClientMessageToAll(redstring[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.
Reply
#2

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)).
Reply
#3

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]"iPlayerstring/*[128]*/
Reply
#4

resolved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)