AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how i put items only for vips? (https://forums.alliedmods.net/showthread.php?t=185203)

skdc 05-14-2012 04:31

how i put items only for vips?
 
well i have a server with vips, and i wanna put items only for vips, can someone teache me how i do it?

thank you.

<VeCo> 05-14-2012 07:04

Re: how i put items only for vips?
 
Check if the user has the vip flag.

PHP Code:

if(get_user_flags(id) & ADMIN_*) // see amxconst.inc for flag defines 


skdc 05-14-2012 07:14

Re: how i put items only for vips?
 
yhe i use this 1 :

#define ADMIN_RESERVATION (1<<1) /* flag "b" */

i alredy put , its only for vips, but the items i put for vips the others players can buy, why?

the normal players buy but they cant use it, only want to put the vips can buy.

<VeCo> 05-14-2012 07:24

Re: how i put items only for vips?
 
Then you don't put the check where it should be. If you don't understand scripting - post in the suggestions/request section and show what plugins do you want to make only for vips.

skdc 05-14-2012 07:28

Re: how i put items only for vips?
 
i have it like this.

PHP Code:

#include <amxmodx>
#include <umitem>

#define EspRate    2.5
#define ADMIN_LEVEL_RESERVATION
new PLUGIN_NAME[]     = "UM Item: ESP"
new PLUGIN_AUTHOR[]     = "Cheap_Suit"
new PLUGIN_VERSION[]     = "1.0"

new white
new bool:g_ESP[33]
public 
plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_item("ESP-VIP""Expanding circles around enemies"3200)
    
register_event("ResetHUD""Event_ResetHUD""be")
    
register_event("DeathMsg""Event_DeathMsg""a")
}

public 
plugin_precache() {
    
white precache_model("sprites/white.spr")
}

public 
client_connect(id) {
    
g_ESP[id] = false
}

public 
Event_DeathMsg() 
{
    if(
task_exists(read_data(2))) {
        
remove_task(read_data(2))
    }
}

public 
Event_ResetHUD(id)
{
    if(!
is_user_alive(id) || !g_ESP[id]) {
        return 
PLUGIN_CONTINUE
    
}
    if(!
task_exists(id)) {
        
set_task(EspRate"esp_loop"id__"b")
    }
    return 
PLUGIN_CONTINUE
}

public 
Enable_Item(id
{        
         if (
is_user_alive(id) && (get_user_flags(id) & ADMIN_RESERVATION))
    
g_ESP[id] = true
    set_task
(EspRate"esp_loop"id__"b")
}

public 
Disable_Item(id
{
    
g_ESP[id] = false
    
if(task_exists(id)) {
        
remove_task(id)
    }
}

public 
esp_loop(id)
{    
    if(!
is_user_connected(id) || !is_user_alive(id) || !g_ESP[id]) 
    {
        if(
task_exists(id)) {
            
remove_task(id)
        }
        return 
PLUGIN_CONTINUE
    
}
    
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"a")
    
    for(new 
0iNum; ++i)
    {
        new 
eId iPlayers[i]
        new 
aTeam get_user_team(id)
        new 
bTeam get_user_team(eId)
        if(
aTeam == bTeam || id == eId) {
            continue
        }

        new 
iOrigin[3]
        
get_user_origin(eIdiOrigin0)
            
        
message_begin(MSG_ONESVC_TEMPENTITYiOriginid)
        
write_byte(21)
        
write_coord(iOrigin[0])
        
write_coord(iOrigin[1])
        
write_coord(iOrigin[2] - 35)
        
write_coord(iOrigin[0])
        
write_coord(iOrigin[1])
        
write_coord(iOrigin[2] + 800)
        
write_short(white)
        
write_byte(0)
        
write_byte(1
        
write_byte(6
        
write_byte(8)
        
write_byte(1
        
write_byte(100)
        
write_byte(100)
        
write_byte(255)
        
write_byte(192)
        
write_byte(0)
        
message_end()
    }
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 00:20.

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