SA-MP Forums Archive
[HELP] sscanf 2.6 + zcmd - 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] sscanf 2.6 + zcmd (/showthread.php?tid=376770)



[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(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.


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



Re: [HELP] sscanf 2.6 + zcmd - gilpenner - 11.09.2012

resolved