SA-MP Forums Archive
Kick and Ban have no Reasons - 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 and Ban have no Reasons (/showthread.php?tid=137992)



Kick and Ban have no Reasons - Manuel20 - 31.03.2010

Hello i have this script for kicking an baning allways works but never sea the Reason what is wrong in this script ?

Code:
dcmd_kick(playerid, params[]){
  new string[128], message[64], pID;
  if(IsPlayerAdmin(playerid)){
    if(sscanf(params, "us", pID, message)) return SendClientMessage(playerid, COLOUR_RED, "Command: /kick [ID] [Reason]");
    format(string, sizeof(string), "[Anti-Hack] %s got kicked. Reason: %d", GetName(pID), string);
    SendClientMessageToAll(COLOUR_RED, string);
    Kick(pID);
    }
    else return SendClientMessage(playerid, COLOUR_RED, "* You are not a Admin!");
  return 1;
}

dcmd_ban(playerid, params[]){
  new string[128], message[64], pID;
  if(IsPlayerAdmin(playerid)){
    if(sscanf(params, "us", pID, message)) return SendClientMessage(playerid, COLOUR_RED, "Command: /ban [ID] [Reason]");
    if (!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOUR_RED,"* No Player found.");
    format(string, sizeof(string), "[Anti-Hack] %s got banned. Reason: %d", GetName(pID), string);
    SendClientMessageToAll(COLOUR_RED, string);
    Ban(pID);
    }
    else return SendClientMessage(playerid, COLOUR_RED, "* You are not a Admin!");
  return 1;
}
Sorry for Wrong posting -.-


Re: Kick and Ban have no Reasons - MenaceX^ - 31.03.2010

Reason is a string and you set it as an integer, change %d to %s.


Re: Kick and Ban have no Reasons - Manuel20 - 31.03.2010

okay i have change d to s but it doesnt go on display ist "Test got kicket. Reason: "

no reason why ?


Re: Kick and Ban have no Reasons - Dreftas - 31.03.2010

pawn Code:
dcmd_kick(playerid, params[]){
  new string[128], message[64], pID;
  if(IsPlayerAdmin(playerid)){
    if(sscanf(params, "us", pID, message)) return SendClientMessage(playerid, COLOUR_RED, "Command: /kick [ID] [Reason]");
    format(string, sizeof(string), "[Anti-Hack] %s got kicked. Reason: %s", GetName(pID), message);
    SendClientMessageToAll(COLOUR_RED, string);
    Kick(pID);
  }
  else return SendClientMessage(playerid, COLOUR_RED, "* You are not a Admin!");
  return 1;
}

dcmd_ban(playerid, params[]){
  new string[128], message[64], pID;
  if(IsPlayerAdmin(playerid)){
    if(sscanf(params, "us", pID, message)) return SendClientMessage(playerid, COLOUR_RED, "Command: /ban [ID] [Reason]");
    if (!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOUR_RED,"* No Player found.");
    format(string, sizeof(string), "[Anti-Hack] %s got banned. Reason: %s", GetName(pID), message);
    SendClientMessageToAll(COLOUR_RED, string);
    Ban(pID);
    }
  else return SendClientMessage(playerid, COLOUR_RED, "* You are not a Admin!");
  return 1;
}
Try this.


Re: Kick and Ban have no Reasons - biltong - 31.03.2010

You define message[64] but you don't put anything in it. That's why you get no reason.

Nevermind, I didn't read your sscanf properly.