19.10.2012, 13:56
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
OnDialogResponse
Код:
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; }
Код:
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; }