Raised This Month: $51 Target: $400
 12% 

help with plugin code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mrjk990
Junior Member
Join Date: Oct 2016
Old 10-31-2016 , 16:09   help with plugin code
Reply With Quote #1

hello
i have plugin it's gave to admin 250 hp
i tried to make work for vip too but not work
just check it , if admin gave 250hp , if vip 125hp , if just user do nothing
any on e can help me please
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>

#define PLUGIN "HP PLUGIN"
#define VERSION "1.0"
#define AUTHOR "Tifarg"

#define ADMIN_YETKI ADMIN_IMMUNITY    
#define ADMIN_ISVIP ADMIN_LEVEL_H    


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn,"player","fwdPlayerSpawnPost",1)
}

public 
fwdPlayerSpawnPost(id) {
    if(
access(id,ADMIN_YETKI)) {
        
set_pev(id,pev_health,250.0)
        
set_pev(id,pev_armortype,120.0)
    } else if(
access(id,ADMIN_ISVIP)) {
        
set_pev(id,pev_health,125.0)
        
set_pev(id,pev_armortype,120.0)
    }


Last edited by mrjk990; 10-31-2016 at 16:11.
mrjk990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-31-2016 , 16:17   Re: help with plugin code
Reply With Quote #2

I don't see a problem here?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
mrjk990
Junior Member
Join Date: Oct 2016
Old 10-31-2016 , 16:55   Re: help with plugin code
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
I don't see a problem here?
hi , thank you for response
the code above it's working if player is admin
if player was vip, nothing happened

i want condition
if user_flag == top_level_admin ,250hp for this player
else if user_flag >= vip , 125hp for this player
else do nothing

i hope you understand what i want
mrjk990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-31-2016 , 17:41   Re: help with plugin code
Reply With Quote #4

I understand and the code does exactly that. If he has IMMUNITY flag he gets 250, else if he has the vip flag - 125, else nothing.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
mrjk990
Junior Member
Join Date: Oct 2016
Old 10-31-2016 , 18:10   Re: help with plugin code
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
I understand and the code does exactly that. If he has IMMUNITY flag he gets 250, else if he has the vip flag - 125, else nothing.
OK , ARE YOU CAN TELL ME HOW I CAN DO THAT ?? I DO NOT KNOW HOW WRITE THE CODE
mrjk990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-31-2016 , 18:51   Re: help with plugin code
Reply With Quote #6

The code DOES EXACTLY WHAT YOU WANT.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
PartialCloning
Senior Member
Join Date: Dec 2015
Old 10-31-2016 , 19:12   Re: help with plugin code
Reply With Quote #7

ADMIN_LEVEL_H is flag "t". Are you giving your VIPs the flag "t" in the users.ini file?
PartialCloning is offline
mrjk990
Junior Member
Join Date: Oct 2016
Old 10-31-2016 , 20:05   Re: help with plugin code
Reply With Quote #8

Quote:
Originally Posted by PartialCloning View Post
ADMIN_LEVEL_H is flag "t". Are you giving your VIPs the flag "t" in the users.ini file?
i know that , but i add just flag t to player , and he's become vip , but he's hp stayed 100 !!!
this is my problem
i want a condition ( if user flag t or larger give hem 125hp )
( if hes flag is immunity give hem 250hp)
the function just check if have flag t , nothing else , on my knowledge
mrjk990 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-31-2016 , 21:10   Re: help with plugin code
Reply With Quote #9

It checks flag A and T, so if he has A he gets 250, if he hasn't, it checks for T and gives 125 if he has it. End of story.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
PartialCloning
Senior Member
Join Date: Dec 2015
Old 10-31-2016 , 22:50   Re: help with plugin code
Reply With Quote #10

For any one or more flags between B and T, use:
Code:
#define ADMIN_ISVIP (ADMIN_RESERVATION | ADMIN_KICK | ADMIN_BAN | ADMIN_SLAY | ADMIN_MAP | ADMIN_CVAR | ADMIN_CFG | ADMIN_CHAT | ADMIN_VOTE | ADMIN_PASSWORD | ADMIN_RCON | ADMIN_LEVEL_A | ADMIN_LEVEL_B | ADMIN_LEVEL_C | ADMIN_LEVEL_D | ADMIN_LEVEL_E | ADMIN_LEVEL_F | ADMIN_LEVEL_G | ADMIN_LEVEL_H)

For T-V:
Code:
#define ADMIN_ISVIP (ADMIN_LEVEL_H | ADMIN_MENU | ADMIN_BAN_TEMP | ADMIN_ADMIN)

Edit: You also need to check if user is alive in the forward as it's called when players are spawned into the server.

Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <fakemeta> #define ADMIN_YETKI ADMIN_IMMUNITY #define ADMIN_ISVIP (ADMIN_LEVEL_H | ADMIN_MENU | ADMIN_BAN_TEMP | ADMIN_ADMIN) public plugin_init() {     register_plugin("HP PLUGIN", "1.0", "Tifarg");     RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawnPost", true); } public fwdPlayerSpawnPost(id) {     if(!is_user_alive(id))         return HAM_IGNORED;     if(access(id,ADMIN_YETKI))     {         set_pev(id, pev_health, 250.0)         set_pev(id, pev_armortype, 120.0);     }     else if(access(id,ADMIN_ISVIP))     {         set_pev(id, pev_health, 125.0);         set_pev(id, pev_armortype, 120.0);     }     return HAM_IGNORED; }

Last edited by PartialCloning; 10-31-2016 at 23:00.
PartialCloning 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 07:17.


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