22.01.2015, 16:54
(
Последний раз редактировалось Rabea; 22.01.2015 в 21:29.
)
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];
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.