SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 24/08/2011, 10:19 AM   #1
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 468
Reputation: 63
Default Help me, please /a chat

So, I'm trying to make an admin chat, basically admins can speak with eachother using the command /a [text]
But, I got this command:
Code:
CMD:a(playerid, params[])
{
	new sendername[MAX_PLAYER_NAME], result[128], string[128];
	if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
	if(sscanf(params,"s[128]", result)) return SCM(playerid, COLOR_GOLD,"USAGE: /a [chat]");
	else
	{
	    format(string, sizeof(string),"*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
	    SendAdminMessage(COLOR_GOLD, string);
	}
	return 1;
}
Every time I type for example: /a hello, or anything, I'm getting always this message: "USAGE: /a [chat]", any help, please?
__________________
Jafet_Macario is offline  
Old 24/08/2011, 10:32 AM   #2
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: Help me, please /a chat

Code:
CMD:a(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME];
    if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
    if(isnull(params)) return SCM(playerid,COLOR_GOLD,"USAGE: /a [chat]");
	GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string,160,"*%d Admin %s: %s",PlayerInfo[playerid][pAdmin],sendername,params);
	SendAdminMessage(COLOR_GOLD, string);
    return 1;
}
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 10:39 AM   #3
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 468
Reputation: 63
Default Re: Help me, please /a chat

Damn thanks, noticed that I got the same problem on this command:
Code:
CMD:kick(playerid, params[])
{
	new id, sendername[MAX_PLAYER_NAME], string[128], reason[128];
	if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"  you are not authorized to use this command");
	if(sscanf(params,"us[128]",id, reason)) return SCM(playerid, COLOR_WHITE,"USAGE: /kick [playerid/partofname] [reason]");
	if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_WHITE,"Player is not connected");
	else
	{
	    GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", id, sendername, reason);
		SendClientMessageToAll(COLOR_LIGHTRED,string);
		Kick(id);
	}
	return 1;
}
But I think I can't check if is null because there are 2 parameters? How to make here?
__________________
Jafet_Macario is offline  
Old 24/08/2011, 10:48 AM   #4
=WoR=Varth
High-roller
 
=WoR=Varth's Avatar
 
Join Date: Apr 2011
Location: Indonesia
Posts: 2,046
Reputation: 130
Default Re: Help me, please /a chat

sscanf have isnull in-build code.

Code:
CMD:kick(playerid,params[])
{
    new id,name1[MAX_PLAYER_NAME]name2[MAX_PLAYER_NAME];
    if(!PlayerInfo[playerid][pAdmin] >= 1) return SCM(playerid, COLOR_GREY,"  you are not authorized to use this command");
    if(sscanf(params,"us[128]",id,params)) return SCM(playerid, COLOR_WHITE,"USAGE: /kick [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_WHITE,"Player is not connected");
    GetPlayerName(playerid,name1,sizeof(name1));
	GetPlayerName(id,name2,sizeof(name2));
	format(params,129, "AdmCmd: %s was kicked by %s, reason: %s",name2,name1,params);
	SendClientMessageToAll(COLOR_LIGHTRED,params);
	Kick(id);
    return 1;
}
__________________
(RETIRED)
=WoR=Varth is offline  
Old 24/08/2011, 11:06 AM   #5
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 468
Reputation: 63
Default Re: Help me, please /a chat

^^ thanks again
__________________
Jafet_Macario 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
[FilterScript] Shrewd Chat System V2 (With Smart Chat V3) [Good for Roleplay] =WoR=Varth Filterscripts 24 13/03/2017 12:24 PM
How to make chat and disable the Starting global chat slymatt Help Archive 1 20/07/2011 02:10 AM
Admin Chat < Admins can't see chat or my text, but I can see their chat Andy_McKinley Help Archive 37 17/05/2011 08:26 PM


All times are GMT. The time now is 03:28 PM.


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