SA-MP Forums Archive
Dual working cmd. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dual working cmd. (/showthread.php?tid=566216)



Dual working cmd. - TiXz0r - 04.03.2015

hello, i dont know how to make dual working cmd.

i want make cmd for admins and for helpers, but i want when use helper this cmd, send message to all:

Код:
format(string, sizeof(string),"[SERVER]: "COL_WHITE"Helper %s is cleared chat.", sendername);
i dont want:

Код:
format(string, sizeof(string),"[SERVER]: "COL_WHITE"Admin %s is cleared chat.", sendername);
because ,she not admin. is helper.


SORRY FOR MY BAD ENGLISH
Код:
CMD:cc(playerid, params[])
{

    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_RED, "[GRESKA]: "COL_WHITE"Nemas prava za koristenje ove komande.");
	else
	{
	    new string[248], sendername[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    
		ClearChatboxToAll(playerid,100);
		
		format(string, sizeof(string),""COL_WHITE"Admin %s is cleared chat.", sendername);
		SendClientMessageToAll(COLOR_ORANGE,string);
		
		SendClientMessage(playerid, COLOR_RED, "[SERVER]: You are cleaned chat");
	}
	return 1;
}



Re: Dual working cmd. - CalvinC - 04.03.2015

I guess pAdmin level 1 is helper, and above is administrators?
Then just use a switch to detect if they're level 1 or above.
pawn Код:
switch(PlayerInfo[playerid][pAdmin])
{
    case 1: // Level 1 (helper)
    default: // All other levels (administrator)
}
And SendClientMessageToAll accordingly.


Re: Dual working cmd. - TiXz0r - 04.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
I guess pAdmin level 1 is helper, and above is administrators?
Then just use a switch to detect if they're level 1 or above.
pawn Код:
switch(PlayerInfo[playerid][pAdmin])
{
    case 1: // Level 1 (helper)
    default: // All other levels (administrator)
}
And SendClientMessageToAll accordingly.
No, Admin have pAdmin, helpers have pHelper


Re: Dual working cmd. - CalvinC - 04.03.2015

Then use an if to detect if they have pHelper or pAdmin, and SendClientMessageToAll accordingly.
Example:
pawn Код:
if(PlayerInfo[playerid][pAdmin] > 0) // Administrator
else if(PlayerInfo[playerid][pHelper] > 0) // Helper



Re: Dual working cmd. - TiXz0r - 04.03.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Then use an if to detect if they have pHelper or pAdmin, and SendClientMessageToAll accordingly.
Example:
pawn Код:
if(PlayerInfo[playerid][pAdmin] > 0) // Administrator
else if(PlayerInfo[playerid][pHelper] > 0) // Helper
i dont understound


Re: Dual working cmd. - CalvinC - 04.03.2015

That code will check if his pAdmin level is higher than 0, if so he's an admin, so use SendClientMessageToAll with an admin tag.
The other code checks if his pHelper level is higher than 0, if so use SendClientMessageToAll with an helper tag.