Raised This Month: $ Target: $400
 0% 

Admin powers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rikards1
Member
Join Date: Aug 2009
Old 10-10-2009 , 16:03   Admin powers
Reply With Quote #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(PLUGINVERSIONAUTHOR);
register_cvar(PLUGINVERSIONFCVAR_SERVER0.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(szDir64);
add(szDir64"/blockmaker");
 
//make config folder if it doesn't already exist
if (!dir_exists(szDir))
{
mkdir(szDir);
}
 
get_mapname(szMap32);
formatex(gszNewFile96"%s/%s.bm"szDirszMap);
}
//creat main menu
new size sizeof(gszMainMenu);
add(gszMainMenusize"\yAdmin Power^n^n");
add(gszMainMenusize"\r1. %sNoclip: %s^n");
add(gszMainMenusize"\r2. %sGodmode: %s^n^n^n");
add(gszMainMenusize"\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 1id <= 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(id1);
}
 
//if player has noclip enabled
if (gbAdminNoclip[id])
{
//re-enable noclip on player
set_user_noclip(id1);
}
}
/* 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(szMenu256gszMainMenucolszNoclipcolszGodmode);
 
//show the main menu to the player
show_menu(idgKeysMainMenuszMenu, -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(szMenu256gszBlockMenugszBlockNames[gSelectedBlockType[id]], colcolcolcolcolszNoclipcolszGodmode);
 
//show the block menu to the player
show_menu(idgKeysBlockMenuszMenu, -1"bmBlockMenu");
 
return 
PLUGIN_HANDLED;
}
public 
handleMainMenu(idnum)
{
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(id0);
gbAdminGodmode[id] = false;
}
else
{
//turn on godmode for player
set_user_godmode(id1);
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(id0);
gbAdminNoclip[id] = false;
}
else
{
//turn on noclip for player
set_user_noclip(id1);
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.
rikards1 is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 10-10-2009 , 17:31   Re: Admin powers
Reply With Quote #2

Why you don't test it?

Also, use [php] bbcodes, becouse is hard to read in the [code] bbcode.

Oh, and you have to indent your code.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-10-2009 , 17:43   Re: Admin powers
Reply With Quote #3

Quote:
Originally Posted by Alucard^ View Post
Why you don't test it?

Also, use [php] bbcodes, becouse is hard to read in the [code] bbcode.

Oh, and you have to indent your code.
If I'm not wrong the [quote] tag unindents the code.
vitorrd is offline
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-10-2009 , 18:13   Re: Admin powers
Reply With Quote #4

^ He is right.

You need to use [PHP] Tags and we'll help you.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-10-2009 , 18:17   Re: Admin powers
Reply With Quote #5

or [small] or [pawn] , but recommend to use [php] for long code.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode