16.05.2015, 02:01
Quote:
Код:
new index = (gMenu[menuid][M_LISTITEMS] + 1); if(index > MAX_MENU_ITEMS) return -1; index -= 1; Код:
new index = (gMenu[menuid][M_LISTITEMS]); if(index >= MAX_MENU_ITEMS) return -1; |
Quote:
The ordering in OnPlayerUpdate() could be done better for sure.
pawn Код:
Код:
if(GetPlayerMenuID(playerid) != INVALID_MENU_ID) { new keys, updown, leftright; GetPlayerKeys(playerid, keys, updown, leftright); if(updown == KEY_DOWN) { |
Quote:
Another thing to keep in mind is you are using == to check for keys which will work but you can not be pressing any other keys! Usually keys are checked like below. I won't say this method as long as it was your intention for it to be that way.
Код:
if(updown & KEY_DOWN) |
Updated the download !
playergui.pwn
You hooking mistake:
Quote:
#else #if defined _ALS_OnGameModeInit #undef OnGameModeInit #else #define _ALS_OnGameModeInit #endif #define OnFilterScriptInit GUIP_OnGameModeInit forward GUIP_OnGameModeInit(); #endif |
pawn Код:
#define GUIValidIndex(%0) if(!GUIData[_:%0][GUIActive]) return 0
#define GUIValidElement(%0,%1) if(!GUIData[_:%0][GUIUsed][%1]) return 0
pawn Код:
#define GUIValidIndex(%0) return GUIData[_:%0][GUIActive]
#define GUIValidElement(%0,%1) return GUIData[_:%0][GUIUsed][%1]
The coding of your GUI is pretty good.
I like this method:
pawn Код:
#if defined FILTERSCRIPT
public OnFilterScriptExit()
#else
public OnGameModeExit()
#endif