SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Help Archive (https://forum.sa-mp.com/forumdisplay.php?f=89)
-   -   Kick and Ban have no Reasons (https://forum.sa-mp.com/showthread.php?t=137992)

Manuel20 31/03/2010 12:25 AM

Kick and Ban have no Reasons
 
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 -.-

MenaceX^ 31/03/2010 12:44 AM

Re: Kick and Ban have no Reasons
 
Reason is a string and you set it as an integer, change %d to %s.

Manuel20 31/03/2010 08:24 AM

Re: Kick and Ban have no Reasons
 
okay i have change d to s but it doesnt go on display ist "Test got kicket. Reason: "

no reason why ?

Dreftas 31/03/2010 08:47 AM

Re: Kick and Ban have no Reasons
 
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.

biltong 31/03/2010 09:34 AM

Re: Kick and Ban have no Reasons
 
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.


All times are GMT. The time now is 12:05 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.