/setvip error
#1

Quote:

//================================================== ============================
if(strcmp(cmd, "/setvip1", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 1;
}
return 1;
}
return 1;
}
if(strcmp(cmd, "/setvip2", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 2;
}
return 1;
}
return 1;
}
if(strcmp(cmd, "/setvip3", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 3;
}
return 1;
}
return 1;
}

when i type /setvip1/2/3 the server says UNKNOWN COMMAND.
Reply
#2

Can you put your code in [PAWN] brackets?
Reply
#3

pawn Код:
if(!strcmp(cmdtext, "/setvip1", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 7)
            {
                tmp = strtok(cmdtext, idx);
                giveplayerid = ReturnUser(tmp);
                PlayerInfo[giveplayerid][pVipRank] = 1;
            }
        }
        return 1;
    }
   
    if(!strcmp(cmdtext, "/setvip2", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 7)
            {
                tmp = strtok(cmdtext, idx);
                giveplayerid = ReturnUser(tmp);
                PlayerInfo[giveplayerid][pVipRank] = 2;
            }
        }
        return 1;
    }
   
    if(!strcmp(cmdtext, "/setvip3", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 7)
            {
                tmp = strtok(cmdtext, idx);
                giveplayerid = ReturnUser(tmp);
                PlayerInfo[giveplayerid][pVipRank] = 3;
            }
        }
        return 1;
    }
Reply
#4

Try

pawn Код:
if(strcmp(cmdtext, "/command") == 0)
As I dont use this often i'm unsure of the function of true in this statement

Edit: Just read up on its not your prob 2 sec

Do you have two types of command systems?
Does the command work but still says the command is wrong?
Reply
#5

Use strtok.
Reply
#6

Quote:
Originally Posted by EightTwoFourThree
Посмотреть сообщение
Use strtok.
I dont know if you blind but he is. Read before posting dont post usless, unneeded or offtopic posts.
Reply
#7

pawn Код:
if(strcmp(cmdtext, "/setvip1", true) == 0)
i think this is the right form :O
Reply
#8

now i will try what iPLEOMAX says...
i have another problems, if you can help me...

Quote:

if(!strcmp(cmdtext, "/setvip1", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 1;
}
}
return 1;
}

if(!strcmp(cmdtext, "/setvip2", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 2;
}
}
return 1;
}

if(!strcmp(cmdtext, "/setvip3", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 3;
}
}
return 1;
}

UNKNOWN COMMAND
Reply
#9

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
I dont know if you blind but he is. Read before posting dont post usless, unneeded or offtopic posts.
That's not Strtok... Strtok (Often) replaces cmdtext to cmd, And strtok can detect the spaces in a command,
That as you may see, is not defined / scripted here, Stop that! Again.
Reply
#10

Wait your using the srtcmp native but you are using it incorrectly as I though if you want the case as you define use this.

pawn Код:
if(strcmp(cmdtext, "/command", true) == 0)
Quote:
Originally Posted by EightTwoFourThree
Посмотреть сообщение
That's not Strtok... Strtok (Often) replaces cmdtext to cmd, And strtok can detect the spaces in a command,
That as you may see, is not defined / scripted here, Stop that! Again.

tmp = strtok(cmdtext, idx); Now stop posting useless, unneeded or offtopic posts its againt forum rules
Reply
#11

i want all the commands...because i'm noob in scripting..and at english..)
please give me all the commands...like
Quote:

if(!strcmp(cmdtext, "/setvip1", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 1;
}
}
return 1;
}

if(!strcmp(cmdtext, "/setvip2", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 2;
}
}
return 1;
}

if(!strcmp(cmdtext, "/setvip3", true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 7)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
PlayerInfo[giveplayerid][pVipRank] = 3;
}
}
return 1;
}

Thanks
Reply
#12

Quote:
Originally Posted by IceCube!
View Post
Wait your using the srtcmp native but you are using it incorrectly as I though if you want the case as you define use this.

pawn Code:
if(strcmp(cmdtext, "/command", true) == 0)




tmp = strtok(cmdtext, idx); Now stop posting useless, unneeded or offtopic posts its againt forum rules
I know the solution has been found,
But i didn't exlapined myself currectly:
Use Strtok in the Strcmp function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)