/kick command problem
#1

Hello, i got a problem with my /kick cmd. When i do /kick ID. It just shows up the text again.

This is my command.

pawn Код:
new string[256];
    new cmd[128];
    new tmp[128];
    new giveplayerid;
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/kick", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_RED, "/kick id or name");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            if(PlayerInfo[playerid][pAdminLevel] >= 2)
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    Kick (giveplayerid);
                }
            }
        }
        return 1;
    }
I cant figure it out.

So, Whats wrong with it?

Thanks,Alex
Reply
#2

I suggest you to use Sscanf2 And Zcmd.
Reply
#3

Quote:
Originally Posted by Clive
Посмотреть сообщение
I suggest you to use Sscanf2 And Zcmd.
Yea, but first i need to fix it.
Reply
#4

Ehm no, not really. If you convert to sscanf you'll have to restructure your code anyway.

Quote:
Originally Posted by AlexzzPro
Посмотреть сообщение
It just shows up the text again.
What text?
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ehm no, not really. If you convert to sscanf you'll have to restructure your code anyway.


What text?
This shows up again when i try to kick myself

Код:
SendClientMessage(playerid, COLOR_RED, "/kick id or name");
Reply
#6

Quote:
Originally Posted by AlexzzPro
Посмотреть сообщение
Yea, but first i need to fix it.
All you have to do in sscanf is

pawn Код:
if(sscanf(params,"uz",user,reason)) return SendClientMessage(playerid,RED,"USAGE: /kick [id] [reason];
Then you have all your vars set up
Reply
#7

Quote:
Originally Posted by Snipa
Посмотреть сообщение
All you have to do in sscanf is

pawn Код:
if(sscanf(params,"uz",user,reason)) return SendClientMessage(playerid,RED,"USAGE: /kick [id] [reason];
Then you have all your vars set up
I dont understand sscanf and zcmd. Thats why i am scripting it in strcmp
Reply
#8

Then what about starting to read some tutorials, and if you need help with it, you can just post topics about it

Believe me, when you start working with zcmd and sscanf, you will say i love my life

The sa-mp forum is here to help you
Reply
#9

Yea i will start to learn it. but i want this in cmd in strcmp
Reply
#10

anyone knows the problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)