|
Senior Member
|

12-23-2008
, 23:15
help me pls with this plugin (compile error)
|
#1
|
this plugin gives #1 ranked player:
votemapmenu
votekickmenu
votebanmenu
amx_slapmenu
all these menus can be used only every 30 minutes or 60 minutes to prevent overuse/ abuse.
please take a look at the code and see what's wrong there. right now the compile error is:
Code:
//// top1_admin.sma
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\scripting\top1_admin.s
ma(99) : error 029: invalid expression, assumed zero
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\scripting\top1_admin.s
ma(99) : error 017: undefined symbol "i"
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\scripting\top1_admin.s
ma(99) : error 017: undefined symbol "j"
// C:\Program Files\Valve\HLServer\cstrike\addons\amxmodx\scripting\top1_admin.s
ma(99) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file C:\Program Files\Valve\HLServer\cstrike\addons\a
mxmodx\scripting\compiled\top1_admin.amx (compile failed).
//
// Compilation Time: 0,11 sec
// ----------------------------------------
Press enter to exit ...
the plugin:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <csx>
#pragma semicolon 1
#define MAP 0 #define SLAP 1 #define KICK 2 #define BAN 3 #define MENU_SIZE 256 #define MENU_PLAYERS 7
new g_iMenuPosition; new g_iMenuPlayers[32]; new g_iMenuOption[32]; new g_iMenuSettings[32];
new pcvars[4];
public plugin_init() { register_plugin("rank 1 limited admin", "1.0", "author"); register_clcmd("say ivotemap", "cmdVoteMapMenu", ADMIN_ALL); register_clcmd("say islap", "cmdSlapMenu", ADMIN_ALL); register_clcmd("say ikick","cmdVoteKickMenu",ADMIN_ALL,"- displays vote kick menu"); register_clcmd("say iban","cmdVoteBanMenu",ADMIN_ALL,"- displays vote ban menu"); register_menucmd(register_menuid("\rVoteKick Menu:"),1023,"VoteKickMenu"); register_menucmd(register_menuid("\rVoteBan Menu:"),1023,"VoteBanMenu"); pcvars[MAP] = register_cvar("amx_votemap_usage", "60"); pcvars[SLAP] = register_cvar("amx_slap_usage", "30"); pcvars[KICK] = register_cvar("amx_votekick_usage", "60"); pcvars[BAN] = register_cvar("amx_voteban_usage", "120"); }
public cmdVoteMapMenu(id, accessLevel) { return get_user_flags(id) & accessLevel ? canUseCommand(id, MAP) : PLUGIN_CONTINUE; }
public cmdSlapMenu(id, accessLevel) { return get_user_flags(id) & accessLevel ? canUseCommand(id, SLAP) : PLUGIN_CONTINUE; }
canUseCommand(id, commandIssued) { static lastUseTime[33][4]; new currentTime = get_systime(); new nextUse = lastUseTime[id][commandIssued] - currentTime + get_pcvar_num(pcvars[commandIssued]); if(nextUse > 0) { client_print(id, print_chat, "Error: You cannot use this command for another %d second%s.", nextUse, nextUse > 1 ? "s" : ""); return PLUGIN_HANDLED; } new osef[8]; if(get_user_stats(id, osef, osef) > 1) { client_print(id , print_chat , "**Server: This MENU is only for top1 player! (ADMIN!)"); return PLUGIN_HANDLED; } lastUseTime[id][commandIssued] = currentTime; return PLUGIN_CONTINUE; }
/* ------------ Vote KICK Menu ------------------- */
public cmdVoteKickMenu( id, lvl, cid ) { if( cmd_access( id, lvl, cid, 0 ) ) { g_iMenuOption[id] = 0; g_iMenuSettings[id] = 0;
showVoteKickMenu( id, g_iMenuPosition = 0 ); } return get_user_flags(id) & lvl ? canUseCommand(id, KICK) : PLUGIN_CONTINUE; }
public showVoteKickMenu( id, pos ) { if( pos < 0 ) return
new i, j new szMenuBody[MENU_SIZE] new iCurrKey = 0 new szUserName[32] new iStart = pos * MENU_PLAYERS new iNum
get_players( g_iMenuPlayers, iNum )
if( iStart >= iNum ) iStart = pos = g_iMenuPosition = 0
new iLen = format( szMenuBody, MENU_SIZE-1, "\rVote Kick Menu:\R%d/%d^n\w^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) ) new iEnd = iStart + MENU_PLAYERS new iKeys = (1<<9|1<<7)
if( iEnd > iNum ) iEnd = iNum
for( i = iStart; i < iEnd; i++ ) { j = g_iMenuPlayers[i] get_user_name( j, szUserName, 31 ) //Check if the player has immunity if( (get_user_flags(j) & ADMIN_IMMUNITY) ) { iCurrKey++ iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "\d%d. %s^n\w", iCurrKey, szUserName ) }else { iKeys |= (1<<iCurrKey++) iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName ) } } //Check if it is kick or ban (DELETED!!) iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Vote Kick^n" )
//Cheack if there is more players left if( iEnd != iNum ) { format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit" ) iKeys |= (1<<8) } else format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", pos ? "Back" : "Exit" )
show_menu( id, iKeys, szMenuBody, -1 )
return }
public actionVoteKickMenu( id, key ) { switch( key ) { case 7: g_iMenuSettings[id] = 0 //kick } showVoteKickMenu( id, g_iMenuPosition ) } case 8: showVoteKickMenu( id, ++g_iMenuPosition ) // More Option case 9: showVoteKickMenu( id, --g_iMenuPosition ) // Back Option
// Chose a Player default: { new player = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]
//Get user info
new authid[32] get_user_authid(player,authid,31)
new userid = get_user_userid(player)
//Exec the command
if (equal("4294967295",authid)) { /* check if it is a lan */ new ipa[32] get_user_ip(player,ipa,31,1) server_cmd("addip 2.0 %s;writeip",ipa) /* no need to vote on lan, or? */ } else { server_cmd("amx_votekick #%d",userid) } } server_exec() } } return PLUGIN_HANDLED }
/* ------------ Vote BAN Menu ------------------- */
/* Vote Menu */ public cmdVoteBanMenu( id, lvl, cid ) { if( cmd_access( id, lvl, cid, 0 ) ) { g_iMenuOption[id] = 0; g_iMenuSettings[id] = 0;
showVoteBanMenu( id, g_iMenuPosition = 0 ) } return get_user_flags(id) & lvl ? canUseCommand(id, BAN) : PLUGIN_CONTINUE; }
public showVoteBanMenu( id, pos ) { if( pos < 0 ) return
new i, j new szMenuBody[MENU_SIZE] new iCurrKey = 0 new szUserName[32] new iStart = pos * MENU_PLAYERS new iNum
get_players( g_iMenuPlayers, iNum )
if( iStart >= iNum ) iStart = pos = g_iMenuPosition = 0
new iLen = format( szMenuBody, MENU_SIZE-1, "\rVote Ban Menu:\R%d/%d^n\w^n", pos+1, (iNum / MENU_PLAYERS + ((iNum % MENU_PLAYERS) ? 1 : 0 )) ) new iEnd = iStart + MENU_PLAYERS new iKeys = (1<<9|1<<7)
if( iEnd > iNum ) iEnd = iNum
for( i = iStart; i < iEnd; i++ ) { j = g_iMenuPlayers[i] get_user_name( j, szUserName, 31 ) //Check if the player has immunity if( (get_user_flags(j) & ADMIN_IMMUNITY) ) { iCurrKey++ iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "\d%d. %s^n\w", iCurrKey, szUserName ) }else { iKeys |= (1<<iCurrKey++) iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "%d. %s^n", iCurrKey, szUserName ) } } //Check if it is kick or ban (DELETED!!) iLen += format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n8. Vote Ban^n" )
//Cheack if there is more players left if( iEnd != iNum ) { format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n9. More...^n0. %s", pos ? "Back" : "Exit" ) iKeys |= (1<<8) } else format( szMenuBody[iLen], (MENU_SIZE-1-iLen), "^n0. %s", pos ? "Back" : "Exit" )
show_menu( id, iKeys, szMenuBody, -1 )
return }
public actionVoteMenu( id, key ) { switch( key ) { case 7: g_iMenuSettings[id] = 1 //ban } showVoteBanMenu( id, g_iMenuPosition ) } case 8: showVoteBanMenu( id, ++g_iMenuPosition ) // More Option case 9: showVoteBanMenu( id, --g_iMenuPosition ) // Back Option
// Chose a Player default: { new player = g_iMenuPlayers[g_iMenuPosition * MENU_PLAYERS + key]
//Get user info
new authid[32] get_user_authid(player,authid,31)
new userid = get_user_userid(player)
//Exec the command
if (equal("4294967295",authid)) { /* check if it is a lan */ new ipa[32] get_user_ip(player,ipa,31,1) server_cmd("addip 0.0 %s;writeip",ipa) /* no need to vote on lan, or? */ } else { server_cmd("amx_voteban #%d kick;writeid",userid) } } server_exec() } } return PLUGIN_HANDLED }
Last edited by cs1.7; 12-24-2008 at 01:44.
|
|