SA-MP Forums Archive
/kick help - 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 help (/showthread.php?tid=62192)



/kick help - Adil - 18.01.2009

Please everyone suggest good ways of making command /kick, in which we get player id from command. For example /kick 5.


Re: /kick help - Sandra18[NL] - 18.01.2009

Код:
if(strcmp(cmdtext, "/kick", true, 5)==0)
{
  if(!IsPlayerAdmin(playerid)) return 0;
  if(!strlen(cmdtext[6])) 
  {
    SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(playerid, pName, 24);
    format(str, 64, "%s was kicked by an admin!", pName);
    SendClientMessageToAll(0xA9A9A9AA, str);
    Kick(ID);
  }
  return 1;
}



Re: /kick help - Daren_Jacobson - 18.01.2009

pawn Код:
if(strcmp(cmdtext, "/kick", true, 5)==0)
{
  if(!IsPlayerAdmin(playerid)) return 0;
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], str[64];
  GetPlayerName(playerid, pName, 24);
  format(str, 64, "%s was kicked by an admin!", pName);
  SendClientMessageToAll(0xA9A9A9AA, str);
  Kick(ID);
  return 1;
}
Optimized. Thank you ******


Re: /kick help - AlExAlExAlEx - 19.01.2009

to be honest i don't see a difference bettwen the 2 codes.(only 1 , Sandra(;x) used
Код:
 Daren used [pawn])



Re: /kick help - mamorunl - 19.01.2009

Then look better. Sandra's version is better because it will check if the player you are trying to kick is actually connected.

Suggestion: I would use sscanf if I were you.


Re: /kick help - Jakku - 11.05.2009

I need same, but /ban. My own one is corrupt


Re: /kick help - miokie - 11.05.2009

repalce the kick(ID); with Ban(ID);

And Usage text to "Usage: \"/Ban <playerid/partname>\"");


Re: /kick help - Jakku - 11.05.2009

That is the problem, pawno crashes when I change them