04.07.2018, 13:52
I've made a simple asay command that should be sent globally to everyone and have a color depending on the admin level.Level 1 admin has a blue colors, level 2 has red and level 3 has green.The problem is when i do /asay with multiple admins ingame, for example 2 it sends the message twice with different colors since he was lvl 2 and i was lvl 3.
CMD:
Stock:
CMD:
Код:
CMD:asay(playerid,params[]) { if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid,COLOR_ERROR,"Error: {FFFFFF}Unknown command, type /cmds for the list of commands."); else { new text[200]; if(sscanf(params,"s[200]",text)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /asay [message]"); format(text,sizeof(text),"Admin: %s",text); SendMessageToPlayers(text); } return 1; }
Код:
stock SendMessageToPlayers(text[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[i][pAdmin] == 1) { SendClientMessageToAll(COLOR_LEVEL1,text); } else if(PlayerInfo[i][pAdmin] == 2) { SendClientMessageToAll(COLOR_LEVEL2,text); } else if(PlayerInfo[i][pAdmin] == 3) { SendClientMessageToAll(COLOR_LEVEL3,text); } } return 1; }