kick command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: kick command (
/showthread.php?tid=92608)
kick command -
Sfinx_17 - 21.08.2009
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;
}
Re: kick command -
pliva_sb - 21.08.2009
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;
}
|
No playerid
Re: kick command -
dice7 - 21.08.2009
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;
}
|
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
Re: kick command -
MenaceX^ - 21.08.2009
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;
}
|
No playerid
|
You say no playerid but there isn't another option than player..
Use strtok or sscanf..
Re: kick command -
Sfinx_17 - 21.08.2009
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.
Re: kick command -
James_Alex - 21.08.2009
try
pawn Код:
if(strcmp(cmdtext, "/kickplayer, true) == 0)
Re: kick command -
pliva_sb - 21.08.2009
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;
}
|
No playerid
|
You say no playerid but there isn't another option than player..
Use strtok or sscanf..
|
My fault
Re: kick command -
MenaceX^ - 21.08.2009
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))
Re: kick command -
Extremo - 21.08.2009
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.
Re: kick command -
Sfinx_17 - 21.08.2009
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