[Tutorial] Mask System for RP servers.
#1

Mask System


Introduction
Hello everybody, this is my second tutorial, today i will make a tutorial about advanced Mask System.
This system include two commands, /maskon and /maskoff, when you are masked the players won't see your hp, armour and your name, this system used to RolePlay servers.



Setups:


First Setup:

you need zcmd.
Download zcmd.inc file and add to pawn/include after this go to pawno and inlucde the zcmd by, #include <zcmd> at top on pawno.


Second Setup:

First thing to avoid "undfined PlayerInfo" error you must do this:
pawn Код:
enum pInfo
{
    pMaskOn,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Third Setup:
Doing the commands.
pawn Код:
CMD:maskon(playerid, params[]) // this is the way you use since you are using zcmd include.
{
      if(PlayerInfo[playerid][pMaskOn] == 1) return SendPlayerMessage(playerid, -1, "You already masked."); // this checks of you are masked, if you are masked you won't be able to mask on agian.
      for(new i = 0; i < MAX_PLAYERS; i++) // here we telling the script what is "i"
        { // after this all command job will happen, before its is the things that won't able to the command to happen.
            ShowPlayerNameTagForPlayer(i, playerid, 0); // This code will hide your name when you type /maskon
        }
            SendPlayerMessage(playerid, -1, "You are masked now /mask off to remove it"); // this will send a message to the player that he is masked right now, this will happen when you type /maskon
            GameTextForPlayer(playerid,"~r~Mask On",1000,1); // this will send a text for player color red "Mask On" on screen
            PlayerInfo[playerid][pMaskOn] = 1; // this will tell the script that player is masked so he can't type /maskon again untill he /maskoff.
      return 1; // this used to return to the command, now you won't get any warn, if you don't return it will send "unknown command" in the game when you use the command, you must return after every command.
} // this must be added so we tell the script that the command is done.
pawn Код:
CMD:maskoff(playerid, params[]) // this is the way you use since you are using zcmd include, as i explained  up
{
     if(PlayerInfo[playerid][pMaskOn] == 0) return SendPlayerMessage(playerid, -1, "You are not masked to remove the mask."); // [pMaskOn] == 0) means you aren't massked, [0 = no] [1 = yes], and you won't be able to use /maskoff if you aren't masked
     for(new i = 0; i < MAX_PLAYERS; i++)
      { // explanined it up
        ShowPlayerNameTagForPlayer(i, playerid, 1); // this will show your name, hp and armor.
               }
        SendPlayerMessage(playerid, -1 "You aren't masked now /mask on to wear it again"); // this will send a message to player that he is masked now.
        GameTextForPlayer(playerid,"~g~Mask off",1000,1); // this will send a message to the player on screen "mask off" color red
            PlayerInfo[playerid][pMaskOn] = 0; // this will tell the script that player isn't masked anymore so he can use /maskon again.
     return 1; // explanined it up
}

Credits:
Thanks Zeexz for zcmd.


i hope i explained good, and i hope there is no any mistakes becuase i'm beginer scripter.
Reply
#2

Nice and useful system for RP servers thank you for this <3 keep it up! Good luck!
Reply
#3

What is so advance in this?
Reply
#4

Well it helped me with my server.. And everyone liked its true thats its simple but useful for beginners!
Reply
#5

Thanks!
Reply
#6

Any comment?
Reply
#7

O - Optimization

All new:
Код HTML:
Mask[MAX_PLAYERS];
OnPlayerConnect:
Код HTML:
Mask[playerid] = 0;
Код HTML:
CMD:mask(playerid,params[])
{
	if(Mask[playerid] == 0)
	{
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			ShowPlayerNameTagForPlayer(i, playerid, 1);
		}
		SendClientMessage(playerid, -1, "You put a mask write / mask to remove");
		GameTextForPlayer(playerid,"~g~Mask On",1000,1);
		Mask[playerid] = 1;
	}
	else
	{
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			ShowPlayerNameTagForPlayer(i, playerid, 1);
		}
		SendClientMessage(playerid, -1, "You have removed the mask, type / masks to wear");
		GameTextForPlayer(playerid,"~g~Mask Off",1000,1);
		Mask[playerid] = 0;
	}
	return 1;
}
Reply
#8

nice tutorial
Reply
#9

Its good for newbies
- Suggestions from me:
You should add a custom chat.. OnPlayerText
People will see his name by the chats, But it is good for people so they cant even MG
Reply
#10

Yeah, like.
if player masked
"Stranger says: bla bla bla"
and thx!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)