Kick cmd
#1

I ******d and ******d, but in the end I just couldn't find it out myself.

What is wrong with this cmd?
Quote:

CMD:kick(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You have been kicked from the server!");
}
SetTimerEx("DelayedKick", 1000, false, "i", playerid);
{
forward DelayedKick(playerid);
public DelayedKick(playerid);
}
Kick(playerid);
{
else
}
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
{
return 1;
}

Reply
#2

Can someone help me please?
Reply
#3

Are you trying to make a command to kick yourself from the server?
Reply
#4

Guess what, I understood almost everything of the code, So I guess I understand the basic script.
The only thing I didn't understand is,
Quote:

forward DelayedKick(playerid);

What does that mean? What does forwarding mean lol?
Reply
#5

Are you making a command to kick yourself or another player?
Reply
#6

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Guess what, I understood almost everything of the code, So I guess I understand the basic script.
The only thing I didn't understand is, What does that mean? What does forwarding mean lol?
Forwarding is to declare a function when you using publics that how you do it.
https://sampwiki.blast.hk/wiki/Public_functions Please read!

Now, you should understand that the kick won't be immediately.
"1000" is miliseconds which means 1 second. The actual kick will be triggered 1 second after the timer starts. this is required since 0.3x.

By the way, this command will also kick yourself from the server other then the ID you will provide which you won't becuase you didnt tell the command a syntex (sscanf recommended). I can show you but ****** search will be faster. https://sampforum.blast.hk/showthread.php?tid=319000 this thread looks nice for your wish.
(playerid = yourid, if you didnt declare it otherwise)
Reply
#7

Yeah I know that, it's in miliseconds.

And @karan007, I try just to make a kick command, Afterwards I will take a look in tut's and ****** how to make it like "USAGE: /kick [ID]".
But I get the following errors/warnings:
Quote:

C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(38 : warning 225: unreachable code
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(389) : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(389) : warning 215: expression has no effect
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(390) : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(390) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Reply
#8

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Yeah I know that, it's in miliseconds.

And @karan007, I try just to make a kick command, Afterwards I will take a look in tut's and ****** how to make it like "USAGE: /kick [ID]".
But I get the following errors/warnings:
show us the code so we can tell you whats wrong. and unreachable is probably because you return eariler then you should.
Reply
#9

Quote:

376:CMD:kick(playerid, params[])
377:{
378: if(IsPlayerAdmin(playerid))
379: {
380: SendClientMessage(playerid, COLOR_RED, "You have been kicked from the server!");
381: SetTimerEx("DelayedKick", 1000, false, "i", playerid);
382: }
383: else
384: {
385: SendClientMessage(playerid, -1, "SERVER: Unknown command.");
386: }
387: forward DelayedKick(playerid);
388: public DelayedKick(playerid);
389: {
390: Kick(playerid);
391: return 1;
392:}

Errors:
Quote:

C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(387) : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(387) : warning 215: expression has no effect
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(38 : error 029: invalid expression, assumed zero
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(38 : warning 215: expression has no effect
C:\Users\anoll\Desktop\samp03z_svr_R1_win32\gamemo des\practice.pwn(412) : error 030: compound statement not closed at the end of file (started at line 37
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply
#10

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Errors:
firstable what the actual hell is going on with the command? public and forward should not be inside the command.
second you forgot } at the end.
third I'm really suggesting you to look again how @Ralfie created the kick command.

which again will kick YOURSELF from the server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)