need help with /leavedm
#1

Hello There SShady Here
i was Making a DM and a /leavedm command BUt its not Working Kinda

This is the Variable which will check that player is in DM or Not
Код:
new busy[MAX_PLAYERS];
And this is the going to DM Command aka /glassdm
Код:
if(strcmp(cmdtext, "/glassdm", true) == 0)
	{
		ResetPlayerWeapons(playerid);
		new GlassMadness[128], playerName[MAX_PLAYER_NAME], RandomSpawn = random(8);
		GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
		busy[playerid] = 1;
		if (RandomSpawn == 0)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -33.6020,1507.4240,95.4173);
			SetPlayerFacingAngle(playerid, 325.6300);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 1)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -12.6829,1507.4701,95.4341);
			SetPlayerFacingAngle(playerid, 40.2041);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 2)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -12.6831,1544.3137,95.4309);
			SetPlayerFacingAngle(playerid, 146.1118);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 3)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -32.7342,1543.9973,95.4126);
			SetPlayerFacingAngle(playerid, 220.0591);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 4)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -23.6215,1545.4828,95.4222);
			SetPlayerFacingAngle(playerid, 181.8555);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 5)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -11.9289,1525.8883,95.4330);
			SetPlayerFacingAngle(playerid, 89.4213);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 6)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -23.4273,1505.9843,95.4257);
			SetPlayerFacingAngle(playerid, 359.8071);
			SetCameraBehindPlayer(playerid);
		}
		if (RandomSpawn == 7)
		{
			InCar[playerid] = false;
			SetPlayerPos(playerid, -34.1823,1525.6079,95.4088);
			SetPlayerFacingAngle(playerid, 270.5063);
			SetCameraBehindPlayer(playerid);
		}
		GivePlayerWeapon(playerid, 29, 130);
		SetPlayerInterior(playerid, 0);
		new name[MAX_PLAYER_NAME], string[256];
    	GetPlayerName(playerid, name, sizeof(name));
    	format(string, sizeof(string), "{8B8F8F}(TELE):{00FFFB}%s {8B8F8F}Has Joined The GlassDM {00FFFB}/glassdm.", name);
    	SendClientMessageToAll(0xC4C4C4FF, string);
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(ReceiveInfo[i] == true)
				{
					SendClientMessage(i, COLOR_WHITE, GlassMadness);
				}
			}
		}
		return 1;
	}
And This is my /leavedm Command
Код:
if(strcmp(cmdtext, "/leave", true) == 0)
	{
		
			busy[playerid] == 0;
	    	SpawnPlayer(playerid);
			SetCameraBehindPlayer(playerid);
			SendClientMessage(playerid, COLOR_WHITE, "You have Left the Deathmatch Or Minigame..");
			
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "You must be in a Deathmatch Or a Minigun before you can exit it...");
		}
		return 1;
	}
And this Code is also added in The onplayerCOmmandteXt Callback
Код:
if(busy[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"Leave The Deathmatch Or Minigame Using /leave!");
And the
Problem
is This That like i have joined The Dm using /glassdm
It says welcome to DM etc etc
And when i type any Command it says YOu need to leave the DM
And when i type the leavedm command /leave it says
it again says
Command it says YOu need to leave the DM
it means its also disabling the /leave Command
Is there any way so i can Unblock this /leave COmmand in DM
Thnx
Reply
#2

Make it like this:
pawn Код:
if(!strcmp(text,"/leavedm",true) == 0)// checking if text is not /leavedm
{
if(busy[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"Leave The Deathmatch Or Minigame Using /leave!")
}
Not Sure if it will work.....
Reply
#3

pawn Код:
if( strcmp( cmdtext, "/leave", true ) == 0 )
{
    if( busy[ playerid ] == 1 )
    {
        busy[playerid] == 0;
        SpawnPlayer(playerid);
        SetCameraBehindPlayer(playerid);
        SendClientMessage(playerid, COLOR_WHITE, "You have Left the Deathmatch Or Minigame..");
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You must be in a Deathmatch Or a Minigun before you can exit it...");
}
Reply
#4

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
if( strcmp( cmdtext, "/leave", true ) == 0 )
{
    if( busy[ playerid ] == 1 )
    {
        busy[playerid] == 0;
        SpawnPlayer(playerid);
        SetCameraBehindPlayer(playerid);
        SendClientMessage(playerid, COLOR_WHITE, "You have Left the Deathmatch Or Minigame..");
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You must be in a Deathmatch Or a Minigun before you can exit it...");
}
Still having the Problem When i go In DM and type /leave it says
You must be in a Deathmatch Or a Minigun before you can exit it...
Reply
#5

Did you delete this
pawn Код:
if(busy[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"Leave The Deathmatch Or Minigame Using /leave!");
from the callback?
Also, set the variable On connect to 0
pawn Код:
busy[playerid] = 0;
And replace at the leave command the == 0; to = 0;
Reply
#6

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Did you delete this
pawn Код:
if(busy[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"Leave The Deathmatch Or Minigame Using /leave!");
from the callback?
Also, set the variable On connect to 0
pawn Код:
busy[playerid] = 0;
And replace at the leave command the == 0; to = 0;
If i remove it from Callback in Dm if players type any Command then the command will work
so i cannot remove it
Reply
#7

But, if you enter on a DM Zone, it sets to 1. Then in every command it will return the message, even if you type the /leave command.
Reply
#8

Everything Got messed up After doing what you said

When i'am not in DM and i type /leave it says you have left the deathmatch

And when i go in DM and type any command the command works!!

Please Do Something
Reply
#9

Make sure that this line:
pawn Код:
if(busy[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"Leave The Deathmatch Or Minigame Using /leave!");
is BELOW the /leave command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)