PDA

View Full Version : Admin Chat


Shadow0707
10/06/2018, 04:32 AM
Having problem with this

CMD:a(playerid, params[]) {
new string[128];
foreach (new i : Player)
{
if (pStats[i][userAdmin] == 1)
{
if(isnull(params)) return SendClientMessage(playerid, red, "Usage: /a <Text>");
format(string, 128, "[Basic Moderator] {00FC00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(orange, string);
}
else if (pStats[i][userAdmin] == 2)
{
format(string, 128, "[Moderator] {00FC00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(green, string);
}
else if (pStats[i][userAdmin] == 3)
{
format(string, 128, "[Global Moderator] {00FF00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(blue, string);
}
else if (pStats[i][userAdmin] == 4)
{
format(string, 128, "[Lead Administrator] {00FC00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(Platinum, string);
}
else if (pStats[i][userAdmin] == 5)
{
format(string, 128, "[Head Admin] {00FC00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(Platinum, string);
}
else if (pStats[i][userAdmin] == 6)
{
format(string, 128, "[CEO] {00FC00}%s: %s", ReturnPlayerName(i), params);
MessageToAdmins(red, string);
} else return SendClientMessage(playerid, red, "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.

Jessyy
10/06/2018, 05:48 AM
hope this helps you in some way.


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;
}

Shadow0707
10/06/2018, 05:58 AM
hope this helps you in some way.


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
forward MessageToAdmins(color, const string[]);
public MessageToAdmins(color, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if(pStats[i][userAdmin] == 1) SendClientMessage(i, color, string);
}
return 1;
}

Mike861
10/06/2018, 06:42 AM
Try >= 1 instead of == 1 in MessageToAdmins

Shadow0707
10/06/2018, 06:45 AM
Try >= 1 instead of == 1 in MessageToAdmins

Worked thanks ! +rep both of you :)