Enable / Disable a zone !
#1

Hello Guys !! I made a code to disable and enable a Zone By the Admin ... but When i enable it the others players can't join to it ( Thz Zone Is Locked ) But me i can join it because i opened it ... can u Help I want all players can join it when i enable it and thank you

This is The code :


Код:
//****************
    if(!strcmp(cmdtext,"/dm",true)) {
    if(DM1[playerid] == 1)return SendClientMessage(playerid,COLOR_RED, "ERROR: You are already in this zone.");
    if(DM1_Options[playerid] == false) return SendClientMessage(playerid,COLOR_RED, "ERROR: This zone is locked.");
             SendClientMessage(playerid, COLOR_YELLOW,"[DM]: Welcome to DeathMatch .. Kill Or You'll Be Killed!");
	SendClientMessage(playerid, COLOR_RED,"[DM]: Type /exitdm To Exit The DeathMatch");
    ResetPlayerWeapons(playerid);
	GivePlayerWeapon(playerid, 24, 99999999);
    GivePlayerWeapon(playerid, 26, 99999999);
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    new Random = random(5);
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
    SetPlayerWorldBounds(playerid, 1415.919, 1283.154, 2219.791, 2096.013);
    IsInDm = 1;
    IsInDm2 = 0;
    DM1[playerid] = 1;
    return 1;
	}
// ******************
	if (strcmp("/exitdm", cmdtext, true, 10) == 0)
	{
	if(DM1[playerid] == 0)return SendClientMessage(playerid,COLOR_RED, "ERROR: You are not in this zone.");
	SpawnPlayer(playerid);
	ResetPlayerWeapons(playerid);
	SendClientMessage(playerid, COLOR_YELLOW,"You Exited The DeathMatch");
	SetPlayerWorldBounds(playerid, 10000, -10000, 10000, -10000);
	IsInDm = 0;
	IsInDm2 = 0;
	return 1;
	}
//****************
	if(strcmp("/Enabledm1", cmdtext, true) == 0)
	{
	    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: You are not an admin !");
	    if(DM1_Options[playerid] == true) return SendClientMessage(playerid,COLOR_RED, "ERROR: The dm is already opened.");
		DM1_Options[playerid] = true;
		SendClientMessageToAll(blue,"The DeathMatch is opened by the admin waim, type [/dm] to join !");
		return true;
	}
// *******************
	if(strcmp("/Disabledm1", cmdtext, true) == 0)
	{
	    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: You are not an admin !");
	    if(DM1_Options[playerid] == false)return SendClientMessage(playerid,COLOR_RED, "ERROR: The dm is already closed.");
		DM1_Options[playerid] = false;
		for(new i;i<MAX_PLAYERS;i++)
		{
			DM1[i] = 0;
		}
		SendClientMessageToAll(blue,"The DeathMatch is closed by the admin waim.");
		return true;
	}
// *******************
Reply
#2

pawn Код:
for(new i; i = 0; i < MAX_PLAYERS; i++)
{
    // code ..
}
also define DM1_Options[playerid] to DM1_Options[i] because DM1_Options[playerid] defines to your playerid, and it isn't looped through all players
Reply
#3

Can you expalin to me more Please ?
Reply
#4

//************** UP ************//
Reply
#5

//************** UP ************//
Reply
#6

//************** UP ************//
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)