SA-MP Forums Archive
ZCMD String - 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: ZCMD String (/showthread.php?tid=512261)



ZCMD String - Lirbo - 09.05.2014

pawn Код:
COMMAND:name(playerid,params[]){
if(!Logged{playerid}) return 0;
if(!sscanf(params,"s",p1)){
if(p1 == "on"){}}return 1;}
the wrong line is the last line


Re: ZCMD String - Ciandlah - 10.05.2014

Hopefully this has helped you out

Quote:

COMMAND:name(playerid,params[])
{
if(!Logged{playerid}) return 0;
if(!sscanf(params,"s",p1))
{
if(p1 == "on")
{
NOTHING HERE, THATS WHY YOU HAVE AN ERROR
}
}
return 1;
}




Re: ZCMD String - Beckett - 10.05.2014

What's the error I don't see anything cause an error here?

pawn Код:
COMMAND:name(playerid,params[])
{
    if(!Logged{playerid}) return 0;
    if(!sscanf(params,"s",p1))
    {
        if(p1 == "on")
        {
                // do something here?
        }
    }
    return 1;
}



Re: ZCMD String - Lirbo - 10.05.2014

Quote:
Originally Posted by Lirbo
Посмотреть сообщение
pawn Код:
COMMAND:name(playerid,params[]){
if(!Logged{playerid}) return 0;
if(!sscanf(params,"s",p1)){
if(p1 == "on"){}}return 1;}
the wrong line is the last line
array must be indexed (variable "-unknown-")


Re: ZCMD String - Stinged - 10.05.2014

What the hell is p1?
Use params, and if you only want a string, don't use sscanf.


Re: ZCMD String - HyperZ - 10.05.2014

Try this:
pawn Код:
COMMAND:name(playerid, params[])
{
    if(!Logged{playerid}) return 0;
    if(isnull(params))
    {
        if(strcmp(params,"On",true) == 0)
        {
            // Do something..
        }
    }
    return 1;
}



Re: ZCMD String - Stinged - 10.05.2014

Don't use strlen with zcmd.
Use isnull(string[])