SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/06/2018, 04:32 AM   #1
Shadow0707
Big Clucker
 
Join Date: Sep 2016
Posts: 92
Reputation: 7
Default Admin Chat

Having problem with this

PHP Code:
CMD:a(playeridparams[]) {
    new 
string[128];
    foreach (new 
Player)
    {
    if (
pStats[i][userAdmin] == 1)
    {
        if(
isnull(params)) return SendClientMessage(playeridred"Usage: /a <Text>");
        
format(string128"[Basic Moderator] {00FC00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(orangestring);
    }
    else if (
pStats[i][userAdmin] == 2)
    {
        
format(string128"[Moderator] {00FC00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(greenstring);
    }
    else if (
pStats[i][userAdmin] == 3)
    {
        
format(string128"[Global Moderator] {00FF00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(bluestring);
     }
    else if (
pStats[i][userAdmin] == 4)
    {
        
format(string128"[Lead Administrator] {00FC00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(Platinumstring);
    }
    else if (
pStats[i][userAdmin] == 5)
    {
        
format(string128"[Head Admin] {00FC00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(Platinumstring);
    }
     else if (
pStats[i][userAdmin] == 6)
    {
        
format(string128"[CEO] {00FC00}%s: %s"ReturnPlayerName(i), params);
        
MessageToAdmins(redstring);
    } else return 
SendClientMessage(playeridred"ERROR: You need to be level 1 to Use this command");
    return 
1;
}
    return 
1;

the problem is it only works if the player is Level 1 doesn't work to level 2-6 sends nothing no errors at all.
Shadow0707 is offline   Reply With Quote
Old 10/06/2018, 05:48 AM   #2
Jessyy
Huge Clucker
 
Join Date: May 2009
Posts: 248
Reputation: 91
Default Re: Admin Chat

hope this helps you in some way.

Code:
CMD:a(playerid, params[])
{
	if(isnull(params)) {
		SendClientMessage(playerid, red, "Usage: /a [text]")
		return 1;
	}
	
	if(pStats[playerid][userAdmin] < 1) {
		SendClientMessage(playerid, red, "ERROR: You need to be at least level 1 in order use this command");
		return 1;
	}
	
	static RanksData[][2] = {
		{"Unknown", COLOUR_WARNING},		// 0
		{"Basic Moderator", orange},		// 1
		{"Moderator", green},				// 2
		{"Global Moderator", blue},			// 3
		{"Lead Administrator", Platinum},	// 4
		{"Head Admin", Platinum},			// 5
		{"CEO", red}						// 6
	};
	
	new szMessage[128];
	format(szMessage, sizeof(szMessage), "[%s] {00FC00}%s: %s", RanksData[pStats[playerid][userAdmin]][0], ReturnPlayerName(playerid), params);
	MessageToAdmins(RanksData[pStats[playerid][userAdmin]][1], szMessage);
	
	return 1;
}
__________________
Always have your stuff when you need it with Dropbox. 2GB account is free! https://db.tt/dgsaOztP
Works at loading... Please wait ███████████████]99.9%
Jessyy is offline   Reply With Quote
Old 10/06/2018, 05:58 AM   #3
Shadow0707
Big Clucker
 
Join Date: Sep 2016
Posts: 92
Reputation: 7
Default Re: Admin Chat

Quote:
Originally Posted by Jessyy View Post
hope this helps you in some way.

Code:
CMD:a(playerid, params[])
{
	if(isnull(params)) {
		SendClientMessage(playerid, red, "Usage: /a [text]")
		return 1;
	}
	
	if(pStats[playerid][userAdmin] < 1) {
		SendClientMessage(playerid, red, "ERROR: You need to be at least level 1 in order use this command");
		return 1;
	}
	
	static RanksData[][2] = {
		{"Unknown", COLOUR_WARNING},		// 0
		{"Basic Moderator", orange},		// 1
		{"Moderator", green},				// 2
		{"Global Moderator", blue},			// 3
		{"Lead Administrator", Platinum},	// 4
		{"Head Admin", Platinum},			// 5
		{"CEO", red}						// 6
	};
	
	new szMessage[128];
	format(szMessage, sizeof(szMessage), "[%s] {00FC00}%s: %s", RanksData[pStats[playerid][userAdmin]][0], ReturnPlayerName(playerid), params);
	MessageToAdmins(RanksData[pStats[playerid][userAdmin]][1], szMessage);
	
	return 1;
}
Still the same works with level 1 only..

Here's my messagetoadmins but I don't think this is the problem
PHP Code:
forward MessageToAdmins(color, const string[]);
public 
MessageToAdmins(color, const string[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) == 1) if(pStats[i][userAdmin] == 1SendClientMessage(icolorstring);
    }
    return 
1;

Shadow0707 is offline   Reply With Quote
Old 10/06/2018, 06:42 AM   #4
Mike861
Huge Clucker
 
Join Date: Feb 2018
Posts: 233
Reputation: 16
Default Re: Admin Chat

Try >= 1 instead of == 1 in MessageToAdmins
Mike861 is offline   Reply With Quote
Old 10/06/2018, 06:45 AM   #5
Shadow0707
Big Clucker
 
Join Date: Sep 2016
Posts: 92
Reputation: 7
Default Re: Admin Chat

Quote:
Originally Posted by Mike861 View Post
Try >= 1 instead of == 1 in MessageToAdmins
Worked thanks ! +rep both of you
Shadow0707 is offline   Reply With Quote
Reply

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
ooc chat admin aduty green chat Rafaeloo Scripting Help 6 03/02/2016 03:07 PM
admin chat and advisor chat avaible without /aduty /cduty Acres Scripting Help 2 09/01/2015 01:13 PM
[Tutorial] Group Chat Without Symbols(Includes Admin Chat) Yashas Tutorials 0 04/01/2014 04:01 PM
admin chat and tester chat dont work Don_Cage Scripting Help 4 25/03/2013 04:08 PM
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 11:05 AM.


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