SA-MP Forums Archive
TogglePlayerControllable - 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)
+--- Thread: TogglePlayerControllable (/showthread.php?tid=386155)



TogglePlayerControllable - Beljulji - 19.10.2012

i have problem with TogglePlayerControllable i added that players can use /guns in only dm areas so i made when someone type guns TogglePlayerControllable is 0 but i need to make when player click on cancel TogglePlayerControllable will be 1
Код:
if (strcmp("/guns", cmdtext, true, 10) == 0)
	{
		if(IsAtDM[playerid] == 0) return SendClientMessage(playerid, red, "Only in Dm Areas!");
		ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Weapon Lists", "Melees\nPistols\nSub-Machine                    Guns\nRifle's\nAssault Rifle\nShotgun\nHeavy Weapon\nThrown\nOther Melees", "Select", "Cancel");
 		SendClientMessage(playerid,yellow,"You've Been Opened The Weapon Menu/Shop");
                TogglePlayerControllable(playerid,0);
		return 1;
	}
OnDialogResponse
Код:
if(dialogid == DIALOGID)
	{
		if(response)
		{
			if(listitem == 0)
			{
				ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Weapon Menu", "Knuckle Dusters\nGolf Club\nNite Stick\nKnife\nBat\nShovel\nPool Cue\nKatana\nDildo\nSpray Can\n", "Select", "Cancel");
			}
			if(listitem == 1)
			{
				ShowPlayerDialog(playerid, DIALOGID+2, DIALOG_STYLE_LIST, "Weapon Menu", "9mm\nSilenced 9mm\nDesert Eagle", "Get", "Cancel");
			}
			if(listitem == 2)
			{
				ShowPlayerDialog(playerid, DIALOGID+3, DIALOG_STYLE_LIST, "Weapon Menu", "Uzi\nSMG\nTec9", "Get", "Cancel");
			}
			if(listitem == 3)
			{
				ShowPlayerDialog(playerid, DIALOGID+4, DIALOG_STYLE_LIST, "Weapon Menu", "Country Rifle\nSniper Rifle", "Get", "Cancel");
			}
			if(listitem == 4)
			{
				ShowPlayerDialog(playerid, DIALOGID+5, DIALOG_STYLE_LIST, "Weapon Menu", "AK-47\nM4", "Get", "Cancel");
			}
			if(listitem == 5)
			{
				ShowPlayerDialog(playerid, DIALOGID+6, DIALOG_STYLE_LIST, "Weapon Menu", "Standard Shotgun\nSawnoff Shotgun\nCombat Shotgun", "Get", "Cancel");
			}
			if(listitem == 6)
			{
				ShowPlayerDialog(playerid, DIALOGID+7, DIALOG_STYLE_LIST, "Weapon Menu", "Rocket Laucher\nHeat Seake\nChain Saw", "Get", "Cancel");
			}
			if(listitem == 7)
			{
				ShowPlayerDialog(playerid, DIALOGID+8, DIALOG_STYLE_LIST, "Weapon Menu", "Granade\nTear Gas", "Get", "Cancel");
			}
            if(listitem == 8)
			{
				ShowPlayerDialog(playerid, DIALOGID+9, DIALOG_STYLE_LIST, "Weapon Menu", "Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers", "Get", "Cancel");
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+1)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 1, 1);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 2, 1);
			}
			if(listitem == 2)
			{
				GivePlayerWeapon(playerid, 3, 1);
			}
			if(listitem == 3)
			{
				GivePlayerWeapon(playerid, 4, 1);
			}
			if(listitem == 4)
			{
				GivePlayerWeapon(playerid, 5, 1);
			}
			if(listitem == 5)
			{
				GivePlayerWeapon(playerid, 6, 1);
			}
			if(listitem == 6)
			{
				GivePlayerWeapon(playerid, 7, 1);
			}
			if(listitem == 7)
			{
				GivePlayerWeapon(playerid, 8, 1);
			}
			if(listitem == 8)
			{
				GivePlayerWeapon(playerid, 10, 1);
			}
			if(listitem == 9)
			{
				GivePlayerWeapon(playerid, 41, 99999);
			}
            if(listitem == 10)
			{
				GivePlayerWeapon(playerid, 15, 1);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+2)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 22, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 23, 99999);
			}
			if(listitem == 2)
			{
				GivePlayerWeapon(playerid, 24, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+3)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 28, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 29, 99999);
			}
			if(listitem == 2)
			{
				GivePlayerWeapon(playerid, 32, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+4)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 33, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 34, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+5)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 30, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 31, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+6)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 25, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 26, 99999);
			}
			if(listitem == 2)
			{
	  			GivePlayerWeapon(playerid, 27, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+7)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 35, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 36, 99999);
			}
			if(listitem == 2)
			{
				GivePlayerWeapon(playerid, 9, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+8)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 16, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 17, 99999);
			}
		}
		return 1;
	}
	if(dialogid == DIALOGID+9)
	{
		if(response)
		{
			if(listitem == 0)
			{
				GivePlayerWeapon(playerid, 42, 99999);
			}
			if(listitem == 1)
			{
				GivePlayerWeapon(playerid, 39, 1);
				GivePlayerWeapon(playerid, 40, 1);
			}
			if(listitem == 2)
			{
				GivePlayerWeapon(playerid, 46, 1);
			}
			if(listitem == 3)
			{
				GivePlayerWeapon(playerid, 44, 1);
			}
			if(listitem == 4)
			{
				GivePlayerWeapon(playerid, 14, 1);
			}

		}
		return 1;
	}



Re: TogglePlayerControllable - gtakillerIV - 19.10.2012

This?

PHP код:
if(dialogid == DIALOGID)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
ShowPlayerDialog(playeridDIALOGID+1DIALOG_STYLE_LIST"Weapon Menu""Knuckle Dusters\nGolf Club\nNite Stick\nKnife\nBat\nShovel\nPool Cue\nKatana\nDildo\nSpray Can\n""Select""Cancel");
            }
            if(
listitem == 1)
            {
                
ShowPlayerDialog(playeridDIALOGID+2DIALOG_STYLE_LIST"Weapon Menu""9mm\nSilenced 9mm\nDesert Eagle""Get""Cancel");
            }
            if(
listitem == 2)
            {
                
ShowPlayerDialog(playeridDIALOGID+3DIALOG_STYLE_LIST"Weapon Menu""Uzi\nSMG\nTec9""Get""Cancel");
            }
            if(
listitem == 3)
            {
                
ShowPlayerDialog(playeridDIALOGID+4DIALOG_STYLE_LIST"Weapon Menu""Country Rifle\nSniper Rifle""Get""Cancel");
            }
            if(
listitem == 4)
            {
                
ShowPlayerDialog(playeridDIALOGID+5DIALOG_STYLE_LIST"Weapon Menu""AK-47\nM4""Get""Cancel");
            }
            if(
listitem == 5)
            {
                
ShowPlayerDialog(playeridDIALOGID+6DIALOG_STYLE_LIST"Weapon Menu""Standard Shotgun\nSawnoff Shotgun\nCombat Shotgun""Get""Cancel");
            }
            if(
listitem == 6)
            {
                
ShowPlayerDialog(playeridDIALOGID+7DIALOG_STYLE_LIST"Weapon Menu""Rocket Laucher\nHeat Seake\nChain Saw""Get""Cancel");
            }
            if(
listitem == 7)
            {
                
ShowPlayerDialog(playeridDIALOGID+8DIALOG_STYLE_LIST"Weapon Menu""Granade\nTear Gas""Get""Cancel");
            }
            if(
listitem == 8)
            {
                
ShowPlayerDialog(playeridDIALOGID+9DIALOG_STYLE_LIST"Weapon Menu""Fire Extinguisher\nSatchel Charge\nParachute\nNightvision Goggles\nFlowers""Get""Cancel");
            }
        }
        else
        {
            
TogglePlayerControllable(playerid,1);
        }
    }