ZCMD String
#1

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
Reply
#2

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;
}

Reply
#3

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;
}
Reply
#4

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-")
Reply
#5

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

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;
}
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)