14.06.2012, 13:55
Hello There Guys,
I made this Tutorial For Newbie Scripters to Get Help in Making Two Types Of A.chat.
I have seen many made Two type of a.chat like JuniorAdminChat and SeniorAdminChat etc. but they had Problem that Even Junior Admin Can see Senior Admin Chat. But Of course He can't Use it because we had Set Level of Usage of Admin Chat to Higher Then Junior Admin Chat.
So, here we Start
I made this Tutorial For Newbie Scripters to Get Help in Making Two Types Of A.chat.
I have seen many made Two type of a.chat like JuniorAdminChat and SeniorAdminChat etc. but they had Problem that Even Junior Admin Can see Senior Admin Chat. But Of course He can't Use it because we had Set Level of Usage of Admin Chat to Higher Then Junior Admin Chat.
So, here we Start
Creating Junior Admin Chat STEP BY STEP
STEP 1
We Will Make Junior Admin Chat First.
For Junior Admin Chat
First We will make The text for Using Junior Admin Chat.
We will Write The Following Code Under OnPlayerText(playerid, text[])
pawn Code:
if(text[0] == '.' && PlayerInfo[playerid][Level] > 1) //You Can Change '.' to any text you want example: '#' '!' '*' and etc.
STEP 2
Now We will make a Function which will Loop Through All Players To Check if The User which Used Junior Admin Chat is Connected or Not.
Now after you Add above Code. Add The Following Ones.
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) // This will Loop Through All The Connected Players To check that if User of Junior Admin Chat is Connected Or NOT!
STEP 3
This time we will make at Which Level Can Junior Admin Chat Can be used.
so For this we need to write the Following Code:
pawn Code:
if(PlayerInfo[playerid][Level] > 1) // This Will Check if That Player's Level is Equal Or Greater Then level 1
STEP 4
Its time to make the Chat Function!
for this we need to make New string and the Playername.
pawn Code:
new string[128], GetPlayerName(playerid, string, sizeof(string));
Now we will make the chat
See the Following Code
pawn Code:
format(string, sizeof(string),"JuniorAdminChat %s: %s",string, text[1]); //First %s is for the Admin Name second %s is The Text he write.
MessageToJuniorAdmins(green, string); //You Can Choose any Color You want for Admin Chat. Just change green to any color.
return 0;
}
LAST STEP
Now We will Add Callback for MessageToJuniorAdmins
type the following code at End of Your Script.
pawn Code:
public MessageToJuniorAdmins(color, const, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++}
{
if(IsPlayerConnected(i) == 1)
if(PlayerInfo[playerid][Level] > 1) //Level You have Assigned for This Chat
SendClientMessage(i, color, string)
}
return 1;
}
pawn Code:
forward MessageToJuniorAdmins(color, const, string[])
pawn Code:
public OnPlayerText(playerid, text[])
{
if(text[0] == '.' && PlayerInfo[playerid][Level] >= 1)
{
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"JuniorAdminChat: %s: %s",string,text[1]);
MessageToJuniorAdmins(green,string);
return 0;
}
Thank You For Reading The Tutorial. I Hope it would Helped You a Bit