Help with restricted area for commands
#1

Hi there. i have a garena, a place where gangs are fighting. How i need to do to stop working all comands while player is in garena. Only command in garena is /leave to leave garena. have a good day.
Reply
#2

Very Easy.
Use your saving system like this.
CMD:/garena(playerid, params[])
{
PlayerInfo[playerid][gArena]+= 1; // Makes it known that they are in the arena by putting a 1 next to it in the playerinfo
if(PlayerInfo[gArena] > 0) return SCM(playerid, -1, "You are already in the DM arena");//if they use the command again this will show up as you are already in the zone, so they can not spam the command and keep increasing the variable
return 1;
}

CMD:Anyother command
{
if(PlayerInfo[playerid][gArena] > 0) return SCM(playerid, -1, "You are currently in the dm area");//This checks if the player is in the dm, if they are, it sends a message saying you can not use this command
return 1;
}

Then if you want a leave command
CMD:Leave(playerid, params[])
{
PlayerInfo[playerid][gArena] -= 1;//this reverts it back to 0, when its on 0 they can use commands again.
return 1;
}

Hope this helps , make sure you also have gArena in the enum if you have y_ini or Dini. SCM= SendClientMessage
I wrote this as a Y_Ini type of saving by the way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)