SA-MP Forums Archive
Textdraws KEY_FIRE - 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: Textdraws KEY_FIRE (/showthread.php?tid=657126)



Textdraws KEY_FIRE - Man43 - 01.08.2018

When someone press KEY_FIRE Textdraws are not hidden why?

PHP код:
if(AdminLevel1[playerid] == 1)
        {
            if((
newkeys KEY_FIRE)&&!(oldkeys KEY_FIRE))
            {
                
AdminleveloneText(playerid);
                
SendClientMessage(playerid, -1"{FF0000}Your menu has been closed.");
                
AdminLevel1[playerid] = 0;
            }
            return 
1;
        }
    }
    return 
1;

There are no warrings/errors.

Код:
forward AdminleveloneText(playerid);
public AdminleveloneText(playerid)
{
    TextDrawHideForPlayer(playerid, Textdraw274);
    TextDrawHideForPlayer(playerid, Textdraw275);
    TextDrawHideForPlayer(playerid, Textdraw276);
    TextDrawHideForPlayer(playerid, Textdraw277);
    TextDrawHideForPlayer(playerid, Textdraw278);
    TextDrawHideForPlayer(playerid, Textdraw279);
    TextDrawHideForPlayer(playerid, Textdraw280);
    TextDrawHideForPlayer(playerid, Textdraw281);
    TextDrawHideForPlayer(playerid, Textdraw282);
    TextDrawHideForPlayer(playerid, Textdraw283);
    TextDrawHideForPlayer(playerid, Textdraw284);
    TextDrawHideForPlayer(playerid, Textdraw285);
    TextDrawHideForPlayer(playerid, Textdraw286);
    TextDrawHideForPlayer(playerid, Textdraw287);
    TextDrawHideForPlayer(playerid, Textdraw288);
    TextDrawHideForPlayer(playerid, Textdraw289);
    TextDrawHideForPlayer(playerid, Textdraw290);
    TextDrawHideForPlayer(playerid, Textdraw291);
    TextDrawHideForPlayer(playerid, Textdraw292);
    TextDrawHideForPlayer(playerid, Textdraw293);
    TextDrawHideForPlayer(playerid, Textdraw294);
    TextDrawHideForPlayer(playerid, Textdraw295);
    TextDrawHideForPlayer(playerid, Textdraw296);
    TextDrawHideForPlayer(playerid, Textdraw297);
    TextDrawHideForPlayer(playerid, Textdraw298);
    TextDrawHideForPlayer(playerid, Textdraw299);
    TextDrawHideForPlayer(playerid, Textdraw300);
    TextDrawHideForPlayer(playerid, Textdraw301);
    TextDrawHideForPlayer(playerid, Textdraw302);
    TextDrawHideForPlayer(playerid, Textdraw303);
    TextDrawHideForPlayer(playerid, Textdraw304);
    TextDrawHideForPlayer(playerid, Textdraw305);
    TextDrawHideForPlayer(playerid, Textdraw306);
    TextDrawHideForPlayer(playerid, Textdraw307);
    TextDrawHideForPlayer(playerid, Textdraw308);
    AdminLevel1[playerid] = 0;
    return 1;
}



Re: Textdraws KEY_FIRE - Akeem - 01.08.2018

Put the if admin level inside the if new key.
If I'm correct the AdminLevel1[playerid] stores whether or not the player is an admin. If so you should stop equaling it to 0 at the end of your function.


Re: Textdraws KEY_FIRE - Sew_Sumi - 01.08.2018

Quote:
Originally Posted by Akeem
Посмотреть сообщение
If I'm correct the AdminLevel1[playerid] stores whether or not the player is an admin.
It's more likely related to the level of the admin menu they are in, considering the rest of the code relates to the menu closing.


But yes OP, as Akeem said, your variable usage is messed up...