30.05.2014, 14:09
I have created another textdraw menu and when the player presses the close textdraw, it closes all of the textdraws except for 1.
heres the whole code:
Whenever textdraw clickedid==PlayerInfo[playerid][MenuItems][15] is clicked, all of the textdraws close except for PlayerInfo[playerid][MenuItems][0].
heres the whole code:
Код:
public OnGameModeInit() { PlayerInfo[playerid][MenuItems][0] = TextDrawCreate(159.000000, 170.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][0], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][0], 1); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][0], 0.500000, 20.700002); TextDrawColor(PlayerInfo[playerid][MenuItems][0], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][0], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][0], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][0], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][0], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][0], 0x000055); TextDrawTextSize(PlayerInfo[playerid][MenuItems][0], 480.000000, 0.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][0], 0); PlayerInfo[playerid][MenuItems][1] = TextDrawCreate(167.000000, 176.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][1], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][1], 1); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][1], 0.500000, 19.300004); TextDrawColor(PlayerInfo[playerid][MenuItems][1], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][1], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][1], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][1], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][1], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][1], 85); TextDrawTextSize(PlayerInfo[playerid][MenuItems][1], 473.000000, 0.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][1], 0); PlayerInfo[playerid][MenuItems][2] = TextDrawCreate(368.000000, 277.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][2] , 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][2] , 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][2] , 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][2] , -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][2] , 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][2] , 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][2] , 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][2] , 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][2] , 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][2] , 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][2] , 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][2] , -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][2] , 1); PlayerInfo[playerid][MenuItems][3] = TextDrawCreate(282.000000, 277.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][3], 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][3], 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][3], 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][3], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][3], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][3], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][3], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][3], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][3], 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][3], 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][3], 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][3], -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][3], 1); PlayerInfo[playerid][MenuItems][4] = TextDrawCreate(196.000000, 277.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][4], 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][4], 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][4], 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][4], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][4], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][4], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][4], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][4], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][4], 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][4], 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][4], 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][4], -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][4], 1); PlayerInfo[playerid][MenuItems][5] = TextDrawCreate(196.000000, 190.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][5], 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][5], 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][5], 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][5], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][5], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][5], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][5], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][5], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][5], 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][5], 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][5], 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][5], -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][5], 1); PlayerInfo[playerid][MenuItems][6] = TextDrawCreate(281.000000, 190.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][6], 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][6], 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][6], 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][6], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][6], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][6], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][6], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][6], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][6], 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][6], 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][6], 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][6], -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][6], 1); PlayerInfo[playerid][MenuItems][7] = TextDrawCreate(367.000000, 190.000000, "_"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][7], 1852927231); TextDrawFont(PlayerInfo[playerid][MenuItems][7], 5); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][7], 0.500000, 1.000000); TextDrawColor(PlayerInfo[playerid][MenuItems][7], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][7], 0); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][7], 1); TextDrawSetShadow(PlayerInfo[playerid][MenuItems][7], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][7], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][7], 255); TextDrawTextSize(PlayerInfo[playerid][MenuItems][7], 80.000000, 69.000000); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][7], 19300); TextDrawSetPreviewRot(PlayerInfo[playerid][MenuItems][7], -16.000000, 0.000000, -55.000000, 1.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][7], 1); PlayerInfo[playerid][MenuItems][8] = TextDrawCreate(164.000000, 158.000000, "~w~Menu:"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][8], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][8], 0); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][8], 0.870000, 2.300000); TextDrawColor(PlayerInfo[playerid][MenuItems][8], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][8], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][8], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][8], 0); PlayerInfo[playerid][MenuItems][9] = TextDrawCreate(236.000000, 184.000000, "~w~CharacterOptions:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][9], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][9], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][9], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][9], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][9], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][9], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][9], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][9], 0); PlayerInfo[playerid][MenuItems][10] = TextDrawCreate(320.000000, 184.000000, "~w~Job:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][10], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][10], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][10], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][10], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][10], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][10], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][10], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][10], 0); PlayerInfo[playerid][MenuItems][11] = TextDrawCreate(407.000000, 184.000000, "~w~Vehicle:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][11], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][11], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][11], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][11], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][11], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][11], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][11], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][11], 0); PlayerInfo[playerid][MenuItems][12] = TextDrawCreate(236.000000, 270.000000, "~w~House:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][12], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][12], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][12], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][12], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][12], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][12], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][12], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][12], 0); PlayerInfo[playerid][MenuItems][13] = TextDrawCreate(322.000000, 270.000000, "~w~:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][13], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][13], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][13], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][13], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][13], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][13], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][13], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][13], 0); PlayerInfo[playerid][MenuItems][14] = TextDrawCreate(408.000000, 270.000000, "~g~Buy Ultra Coins:"); TextDrawAlignment(PlayerInfo[playerid][MenuItems][14], 2); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][14], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][14], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][14], 0.210000, 1.100000); TextDrawColor(PlayerInfo[playerid][MenuItems][14], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][14], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][14], 1); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][14], 0); PlayerInfo[playerid][MenuItems][15] = TextDrawCreate(428.000000, 154.000000, "~w~X ~r~close"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][15], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][15], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][15], 0.250000, 1.200000); TextDrawColor(PlayerInfo[playerid][MenuItems][15], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][15], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][15], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][15], 1); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][15], 0); TextDrawTextSize(PlayerInfo[playerid][MenuItems][15], 479.000000, 15.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][15], 1); PlayerInfo[playerid][MenuItems][16] = TextDrawCreate(378.000000, 362.000000, "~w~Ultra Coins: ~b~324"); TextDrawBackgroundColor(PlayerInfo[playerid][MenuItems][16], 255); TextDrawFont(PlayerInfo[playerid][MenuItems][16], 2); TextDrawLetterSize(PlayerInfo[playerid][MenuItems][16], 0.250000, 1.200000); TextDrawColor(PlayerInfo[playerid][MenuItems][16], -1); TextDrawSetOutline(PlayerInfo[playerid][MenuItems][16], 1); TextDrawSetProportional(PlayerInfo[playerid][MenuItems][16], 1); TextDrawUseBox(PlayerInfo[playerid][MenuItems][16], 0); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][16], 0); TextDrawTextSize(PlayerInfo[playerid][MenuItems][16], 600.000000, 100.000000); TextDrawSetSelectable(PlayerInfo[playerid][MenuItems][16], 0); } } CMD:menu(playerid, params[]){ if(PlayerInfo[playerid][MenuMenuItems]==true)return true; PlayerInfo[playerid][MenuMenuItems]=true; PlayerPlaySound(playerid,21000,0,0,0); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][2], 0);//Option 6 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][3], 1212);//Option 5 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][4], 3609);//Option 4 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][5], GetPlayerSkin(playerid));//Option 1 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][6], 1210);//Option 2 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][7], 401);//Option 1 for(new index=0; index<17; index++) TextDrawShowForPlayer(playerid,PlayerInfo[playerid][MenuItems][index]); SelectTextDraw(playerid, 0x000055); return true; } public OnPlayerClickTextDraw(playerid, Text:clickedid){ if(clickedid==PlayerInfo[playerid][MenuItems][15]){//close PlayerInfo[playerid][MenuItems]=false; PlayerInfo[playerid][CharacterOptions]=false; PlayerPlaySound(playerid,21000,0,0,0); for(new index=0; index<17; index++) TextDrawHideForPlayer(playerid,PlayerInfo[playerid][MenuItems][index]); CancelSelectTextDraw(playerid); //////Reseting Values//////// TextDrawSetString(PlayerInfo[playerid][MenuItems][9], "~w~CharacterOptions:"); TextDrawSetString(PlayerInfo[playerid][MenuItems][10], "~w~Job:"); TextDrawSetString(PlayerInfo[playerid][MenuItems][11], "~w~Vehicle:"); TextDrawSetString(PlayerInfo[playerid][MenuItems][12], "~w~House:"); TextDrawSetString(PlayerInfo[playerid][MenuItems][13], "~w~:"); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][2], 0); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][3], 1212); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][4], 3609); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][5], GetPlayerSkin(playerid)); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][6], 1210); TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][7], 401); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][0], 0x000055); ///////////////////////////// } if(clickedid==PlayerInfo[playerid][MenuItems][7]){//Option 6 // CODE } if(clickedid==PlayerInfo[playerid][MenuItems][6]){//Option 5 } if(clickedid==PlayerInfo[playerid][MenuItems][5]){//Option 4 if(PlayerInfo[playerid][CharacterOptions]==false) { PlayerInfo[playerid][CharacterOptions]=true; TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][2], 3082);//Option 6 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][3], 3082);//Option 5 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][4], 3082);//Option 4 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][5], 3082);//Option 1 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][6], 3082);//Option 2 TextDrawSetPreviewModel(PlayerInfo[playerid][MenuItems][7], 1608);//Option 1 TextDrawSetString(PlayerInfo[playerid][MenuItems][9], "Skills"); TextDrawSetString(PlayerInfo[playerid][MenuItems][10], "Skills"); TextDrawSetString(PlayerInfo[playerid][MenuItems][11], "Skills"); TextDrawSetString(PlayerInfo[playerid][MenuItems][12], "Skills"); TextDrawSetString(PlayerInfo[playerid][MenuItems][13], "Skills"); TextDrawBoxColor(PlayerInfo[playerid][MenuItems][0], 0x00CC55); for(new index=0; index<17; index++) { TextDrawHideForPlayer(playerid,PlayerInfo[playerid][MenuItems][index]); TextDrawShowForPlayer(playerid,PlayerInfo[playerid][MenuItems][index]); } } if(PlayerInfo[playerid][CharacterOptions]==true) { } } if(clickedid==PlayerInfo[playerid][MenuItems][4]){//Option 3 // CODE } if(clickedid==PlayerInfo[playerid][MenuItems][3]){//Option 2 // CODE } if(clickedid==PlayerInfo[playerid][MenuItems][2]){//Option 1 } return true; }