SA-MP Forums Archive
/leave command not working - 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: /leave command not working (/showthread.php?tid=234809)



/leave command not working - Madsen - 04.03.2011

hey, i have made a command. the command is /sw (shotgunwar) when you type the command you teleports to a room and you keep spawning in. but you can cheat in there you can use /infernus or other commands i want it to be like you only can type /leave while in there.

i made 2 of those rooms the other is /m4w

Код:
if(m4w[playerid] == 1)
	{
		SendClientMessage(playerid, COLOR_NORMALRED, "You can not use commands when in War! Type /leave to use commands.");
	}
	else
	if(sw[playerid] == 1)
	{
		SendClientMessage(playerid, COLOR_NORMALRED, "You can not use commands when in War! Type /leave to use commands.");
	}
	else
	if (strcmp("/leave", cmdtext, true, 10) == 0)
	{
	    SpawnPlayer(playerid);
	    ResetPlayerWeapons(playerid);
		SetPlayerInterior(playerid, 0);
		sw[playerid] = 0;
		m4w[playerid] = 0;
		return 1;
	}



Re: /leave command not working - Madsen - 04.03.2011

okay i have changed it so i only can write /leave while in in some of the 2 rooms

Код:
if (strcmp("/leave", cmdtext, true, 10) == 0)
	{
		if(m4w[playerid] == 1)
		{
		SpawnPlayer(playerid);
		ResetPlayerWeapons(playerid);
		SetPlayerInterior(playerid, 0);
		sw[playerid] = 0;
		m4w[playerid] = 0;
		return 1;
		}
		else
		if(sw[playerid] == 1)
		{
		SpawnPlayer(playerid);
		ResetPlayerWeapons(playerid);
		SetPlayerInterior(playerid, 0);
		sw[playerid] = 0;
		m4w[playerid] = 0;
		return 1;
		}
		else
		{
		SendClientMessage(playerid, COLOR_NORMALRED, "You can only use this command while in war");
		return 1;
		}
	}
but i also want it to be like when i am in one of the 2 rooms i can't write any other commands than /leave ?

please help me