Enable / Disable a zone ! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Enable / Disable a zone ! (
/showthread.php?tid=164685)
Enable / Disable a zone ! -
waim - 01.08.2010
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;
}
// *******************
Re: Enable / Disable a zone ! -
KennethRandall - 01.08.2010
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
Re: Enable / Disable a zone ! -
waim - 01.08.2010
Can you expalin to me more Please ?
Re: Enable / Disable a zone ! -
waim - 01.08.2010
//************** UP ************//
Re: Enable / Disable a zone ! -
waim - 02.08.2010
//************** UP ************//
Re: Enable / Disable a zone ! -
waim - 03.08.2010
//************** UP ************//