kick command
#1

hello guys...i try to test to see if my kick command work in my script but while i am in the game and type this /kickme why doesn't appear nothing ?

here is my code...

if (strcmp("/Kickplayer", cmdtext, true, 10) == 0)
{
Kick(playerid);
return 1;
}
Reply
#2

Quote:
Originally Posted by Sfinx_17
hello guys...i try to test to see if my kick command work in my script but while i am in the game and type this /kickme why doesn't appear nothing ?

here is my code...

if (strcmp("/Kickplayer", cmdtext, true, 10) == 0)
{
Kick(playerid);
return 1;
}
Код:
Kick(giveplayerid);
No playerid
Reply
#3

Quote:
Originally Posted by [CH
pliva♪ ]
Quote:
Originally Posted by Sfinx_17
hello guys...i try to test to see if my kick command work in my script but while i am in the game and type this /kickme why doesn't appear nothing ?

here is my code...

if (strcmp("/Kickplayer", cmdtext, true, 10) == 0)
{
Kick(playerid);
return 1;
}
Код:
Kick(giveplayerid);
Not playerid
Giveplayerid will result in a unknown variable, since he didn't declare it and he obviously isn't using strtok or dcmd. He just wants to kick himself.

Use this and it should work

pawn Код:
(strcmp("/Kickplayer", cmdtext, 11) == 0)
It's 11 because you also need to count the 'slash' in the string
Reply
#4

Quote:
Originally Posted by [CH
pliva♪ ]
Quote:
Originally Posted by Sfinx_17
hello guys...i try to test to see if my kick command work in my script but while i am in the game and type this /kickme why doesn't appear nothing ?

here is my code...

if (strcmp("/Kickplayer", cmdtext, true, 10) == 0)
{
Kick(playerid);
return 1;
}
Код:
Kick(giveplayerid);
No playerid
You say no playerid but there isn't another option than player..

Use strtok or sscanf..
Reply
#5

i am getting this warning if i use your code dice7........> this code

(strcmp("/Kickplayer", cmdtext, 11) == 0)




C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(276 ) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#6

try
pawn Код:
if(strcmp(cmdtext, "/kickplayer, true) == 0)
Reply
#7

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by [CH
pliva♪ ]
Quote:
Originally Posted by Sfinx_17
hello guys...i try to test to see if my kick command work in my script but while i am in the game and type this /kickme why doesn't appear nothing ?

here is my code...

if (strcmp("/Kickplayer", cmdtext, true, 10) == 0)
{
Kick(playerid);
return 1;
}
Код:
Kick(giveplayerid);
No playerid
You say no playerid but there isn't another option than player..

Use strtok or sscanf..
My fault
Reply
#8

Quote:
Originally Posted by Sfinx_17
i am getting this warning if i use your code dice7........> this code

(strcmp("/Kickplayer", cmdtext, 11) == 0)




C:\PROGRA~1\ROCKST~1\SERVER~1\GAMEMO~1\new.pwn(276 ) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
if(!strcmp(cmdtext,"/kickplayer",true))
Reply
#9

I would suggest you to use the sscanf function from ******. Its a good start for newbies to go with dcmd and sscanf as its the easiest way to work around. As we all know programmers are lazy so just use it and make a different function out of the command and you'll be just fine.
Reply
#10

MenaceX last code what you gave to me is compile...but now in game when i type /kickme why appear
"Server:UnknownCommand"?

if(!strcmp(cmdtext,"/kickplayer",true))

please help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)