|
Member
|

10-10-2009
, 16:03
Admin powers
|
#1
|
Hello, just wonder..... why do I get a lot of errors of this? (made a godmode and noclip plugin of blockmaker  )
PHP Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #include <cstrike> #include <fakemeta> #define PLUGIN "admin_power" #define VERSION "1.0" #define AUTHOR "Rikards1" #define BM_ADMIN_LEVEL ADMIN_MENU //admin access level to use this plugin. ADMIN_MENU = flag 'u' // global booleans new bool:gbAdminGodmode[33]; new bool:gbAdminNoclip[33]; /***** PLUGIN START *****/ public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_cvar(PLUGIN, VERSION, FCVAR_SERVER, 0.0); //register client commands register_clcmd("say /ap", "showMainMenu"); //register forwards register_forward(FM_EmitSound, "forward_EmitSound"); register_menucmd(register_menuid("bmMainMenu"), gKeysMainMenu, "handleMainMenu"); //register events register_event("DeathMsg", "eventPlayerDeath", "a"); register_event("TextMsg", "eventRoundRestart", "a", "2&#Game_C", "2&#Game_w"); register_event("ResetHUD", "eventPlayerSpawn", "b"); register_event("CurWeapon", "eventCurWeapon", "be"); register_logevent("eventRoundRestart", 2, "1=Round_Start"); //make save folder in basedir (new saving/loading method) new szDir[64]; new szMap[32]; get_basedir(szDir, 64); add(szDir, 64, "/blockmaker"); //make config folder if it doesn't already exist if (!dir_exists(szDir)) { mkdir(szDir); } get_mapname(szMap, 32); formatex(gszNewFile, 96, "%s/%s.bm", szDir, szMap); } //creat main menu new size = sizeof(gszMainMenu); add(gszMainMenu, size, "\yAdmin Power^n^n"); add(gszMainMenu, size, "\r1. %sNoclip: %s^n"); add(gszMainMenu, size, "\r2. %sGodmode: %s^n^n^n"); add(gszMainMenu, size, "\r0. \wClose"); gKeysMainMenu = B1 | B2 | B0; /***** FORWARDS *****/ public client_connect(id) { //player doesn't have godmode or noclip gbAdminGodmode[id] = false; gbAdminNoclip[id] = false; } public client_disconnect(id) { } /***** EVENTS *****/ public eventPlayerDeath() { new id = read_data(2); } public eventRoundRestart() { //iterate through all players for (new id = 1; id <= 32; ++id) { //reset all players timers resetTimers(id); } } public eventPlayrSpawn(id) { //if player has godmode enabled if (gbAdminGodmode[id]) { //re-enable godmode on player set_user_godmode(id, 1); } //if player has noclip enabled if (gbAdminNoclip[id]) { //re-enable noclip on player set_user_noclip(id, 1); } } /* MENUS */ public showMainMenu(id) { new col[3]; new szMenu[256]; new szGodmode[6]; new szNoclip[6]; col = (get_user_flags(id) & BM_ADMIN_LEVEL ? "\w" : "\d"); szNoclip = (get_user_noclip(id) ? "\yOn" : "\rOff"); szGodmode = (get_user_godmode(id) ? "\yOn" : "\rOff"); //format the main menu format(szMenu, 256, gszMainMenu, col, szNoclip, col, szGodmode); //show the main menu to the player show_menu(id, gKeysMainMenu, szMenu, -1, "bmMainMenu"); return PLUGIN_HANDLED; } showBlockMenu(id) { new col[3]; new szMenu[256]; new szGodmode[6]; new szNoclip[6]; new szSize[8]; col = (get_user_flags(id) & BM_ADMIN_LEVEL ? "\w" : "\d"); szNoclip = (get_user_noclip(id) ? "\yOn" : "\rOff"); szGodmode = (get_user_godmode(id) ? "\yOn" : "\rOff"); //format the main menu format(szMenu, 256, gszBlockMenu, gszBlockNames[gSelectedBlockType[id]], col, col, col, col, col, szNoclip, col, szGodmode); //show the block menu to the player show_menu(id, gKeysBlockMenu, szMenu, -1, "bmBlockMenu"); return PLUGIN_HANDLED; } public handleMainMenu(id, num) { switch (num) { case N1: { toggleNoclip(id); } case N2: { toggleGodmode(id); } case N0: { return; } } } toggleGodmode(id) { //make sure player has access to this command if (get_user_flags(id) & BM_ADMIN_LEVEL) { //if player has godmode if (get_user_godmode(id)) { //turn off godmode for player set_user_godmode(id, 0); gbAdminGodmode[id] = false; } else { //turn on godmode for player set_user_godmode(id, 1); gbAdminGodmode[id] = true; } } } toggleNoclip(id) { //make sure player has access to this command if (get_user_flags(id) & BM_ADMIN_LEVEL) { //if player has noclip if (get_user_noclip(id)) { //turn off noclip for player set_user_noclip(id, 0); gbAdminNoclip[id] = false; } else { //turn on noclip for player set_user_noclip(id, 1); gbAdminNoclip[id] = true; } } }
There u have the php....
And I´ve tested compile it, get like 5 errors...... but I think thats pretty few, couse its my first plugin ^^
Last edited by rikards1; 10-11-2009 at 03:49.
|
|