SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 31/03/2010, 12:25 AM   #1
Manuel20
Little Clucker
 
Join Date: Jan 2010
Posts: 16
Reputation: 0
Default 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 -.-
Manuel20 is offline  
Old 31/03/2010, 12:44 AM   #2
MenaceX^
High-roller
 
Join Date: Aug 2008
Posts: 3,262
Reputation: 13
Default Re: Kick and Ban have no Reasons

Reason is a string and you set it as an integer, change %d to %s.
MenaceX^ is offline  
Old 31/03/2010, 08:24 AM   #3
Manuel20
Little Clucker
 
Join Date: Jan 2010
Posts: 16
Reputation: 0
Default 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 ?
Manuel20 is offline  
Old 31/03/2010, 08:47 AM   #4
Dreftas
Gangsta
 
Join Date: May 2008
Posts: 515
Reputation: 0
Default 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.
Dreftas is offline  
Old 31/03/2010, 09:34 AM   #5
biltong
Gangsta
 
Join Date: Jan 2010
Posts: 546
Reputation: 0
Default 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.
__________________
My releases:
[FS]Admin Click - An admin shortcut script. Lots of commands like kick and ban in a few mouse clicks!
[FS]Vehicle Names - Simple script that displays your vehicle's name whenever you enter one.
[GM]Cops 'n Criminals - An unusual TDM.


Not active anymore, PM me if necessary.
biltong is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NPC Timout??????? What can be the reasons for it???? DJ-CJ89 Help Archive 1 13/06/2010 01:53 PM
[Suggestion] Reasons LukeGFX General 8 17/01/2010 10:31 AM
Reasons aren't showing _Vortex Help Archive 9 07/09/2009 11:55 PM
Player disconnect reasons asteroid Help Archive 1 07/09/2009 02:54 PM
LVA problems for odd reasons Turricane Help Archive 7 20/06/2009 11:21 AM


All times are GMT. The time now is 04:24 PM.


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