Skip to content

Commit

Permalink
expirecheck for menus too
Browse files Browse the repository at this point in the history
/soundlist
  • Loading branch information
mforce95 committed May 8, 2016
1 parent c4d1d67 commit 71a8d8c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Funny Sounds/scripting/funny_sounds_with_menu.sma
Expand Up @@ -73,18 +73,22 @@ public sayhandler(id) {
for(new i; i<g_aSize; i++) {
ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
if(equali(message, sSoundName)) {
new usrtime = get_user_time(id);

if(usrtime >= g_iTimeExpired[id]) {
playsound(i);
g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
}
else
ColorChat(id, NORMAL, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
expirecheck(id, i);
}
}
}

expirecheck(id, item) {
new usrtime = get_user_time(id);

if(usrtime >= g_iTimeExpired[id]) {
playsound(item);
g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
}
else
ColorChat(id, NORMAL, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
}

playsound(item) {
new szSound[64]; ArrayGetString(musicpath, item, szSound, charsmax(szSound));
new makesound[128];
Expand Down Expand Up @@ -165,7 +169,7 @@ public musicmenu_h(id, menu, item) {
return PLUGIN_HANDLED;
}

playsound(item);
expirecheck(id, item);

menu_destroy(menu);
return PLUGIN_HANDLED;
Expand Down

0 comments on commit 71a8d8c

Please sign in to comment.