AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help with cs_get_user_team (https://forums.alliedmods.net/showthread.php?t=130657)

BloodMan 06-26-2010 04:28

Need help with cs_get_user_team
 
Theres something fishy with this plugin, even CT's can use it. And it seems that everyone can use it... I would like it to be admins only. They should have ADMIN_LEVEL_H.

Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <cstrike>

new bool:FirstSpawn[33]
public plugin_init()
{
    RegisterHam        (Ham_Spawn, "player", "Player_Spawn", 1)
    register_forward( FM_PlayerPreThink, "forward_player_prethink" );
    register_logevent( "logevent_round_start", 2, "1=Round_Start" );

}
public Player_Spawn(id)
{
    if( !is_user_alive(id) &% cs_get_user_team(id) == CS_TEAM_T)

        {
            FirstSpawn[id] = true
            return
        }
    FirstSpawn[id] = false

    new menu = menu_create("Zombiu VIP Meniu:", "vip_menu");

    menu_additem(menu ,"Daugiau Sveikatos", "1" , ADMIN_LEVEL_H);
    menu_additem(menu ,"Greitas Begimas", "2" , ADMIN_LEVEL_H);
    menu_additem(menu ,"Gravitacija", "3" , ADMIN_LEVEL_H);



    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);
}
public vip_menu(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);


    new key = str_to_num(data);

    switch(key)
    {
case 1:
        {
            fm_set_user_health( id, get_user_health( id ) + 1500 );
            client_print(id, print_chat, "Gavai daugiau Sveikatos, dabar tu stiprus!");
        }
case 2:
        {
            new Float:speed = get_user_maxspeed(id) + 85.0;
            set_user_maxspeed(id , speed);
            client_print(id, print_chat, "Begsi dabar labai greitai!");
        }
case 3:
        {
            fm_set_user_gravity( id, 0.5 );
            client_print(id, print_chat, "O dabar sokinesi kaip kengura!");
        }
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}


drekes 06-26-2010 05:10

Re: Need help with cs_get_user_team
 
Code:

public Player_Spawn(id)
{
    if( !is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)

        {
            FirstSpawn[id] = true
            return
        }
        //......

And you could try to indent it better.

BloodMan 06-26-2010 05:29

Re: Need help with cs_get_user_team
 
Thanks.

GXLZPGX 06-26-2010 05:34

Re: Need help with cs_get_user_team
 
Quote:

Originally Posted by BloodMan (Post 1220216)
Thanks.

You do know that

PHP Code:

!is_user_alive(id

Is for dead players right?

drekes 06-26-2010 05:41

Re: Need help with cs_get_user_team
 
Quote:

Originally Posted by GXLZPGX (Post 1220219)
You do know that

PHP Code:

!is_user_alive(id

Is for dead players right?

Didn't notice that :oops:

GXLZPGX 06-26-2010 05:52

Re: Need help with cs_get_user_team
 
Quote:

Originally Posted by drekes (Post 1220221)
Didn't notice that :oops:

Lol I was talking to BloodMan -.-

drekes 06-26-2010 05:58

Re: Need help with cs_get_user_team
 
well, since he is returning when a player is dead. I assume he knows it.
Code:

if( !is_user_alive(id) )

        {
            FirstSpawn[id] = true
            return
        }


RedRobster 06-26-2010 08:07

Re: Need help with cs_get_user_team
 
It seems that that is what he wants though. He's opening it up on player spawn, and if for some reason, the player is dead, he doesn't want the menu to be shown to them.

Devil259 06-26-2010 08:27

Re: Need help with cs_get_user_team
 
Quote:

Originally Posted by BloodMan (Post 1220174)
How to make so that this menu would only work for terrorist team?


Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <cstrike>
 
new bool:FirstSpawn[33]
public plugin_init()
{
    RegisterHam        (Ham_Spawn, "player", "Player_Spawn", 1)
    register_forward( FM_PlayerPreThink, "forward_player_prethink" );
    register_logevent( "logevent_round_start", 2, "1=Round_Start" );
 
}
public Player_Spawn(id)
{
    if( !is_user_alive(id) )
 
        {
            FirstSpawn[id] = true
            return
        }
    FirstSpawn[id] = false
 
    new menu = menu_create("Zombiu VIP Meniu:", "vip_menu");
 
    menu_additem(menu ,"Daugiau Sveikatos", "1" , ADMIN_LEVEL_H);
    menu_additem(menu ,"Greitas Begimas", "2" , ADMIN_LEVEL_H);
    menu_additem(menu ,"Gravitacija", "3" , ADMIN_LEVEL_H);
 
 
 
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
 
    menu_display(id, menu, 0);
}
public vip_menu(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
 
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
 
 
    new key = str_to_num(data);
 
    switch(key)
    {
case 1:
        {
            fm_set_user_health( id, get_user_health( id ) + 1500 );
            client_print(id, print_chat, "Gavai daugiau Sveikatos, dabar tu stiprus!");
        }
case 2:
        {
            new Float:speed = get_user_maxspeed(id) + 90.0;
            set_user_maxspeed(id , speed);
            client_print(id, print_chat, "Begsi dabar labai greitai!");
        }
case 3:
        {
            fm_set_user_gravity( id, 0.5 );
            client_print(id, print_chat, "O dabar sokinesi kaip kengura!");
        }
    }
 
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}


You included two times fakemeta.. :oops:

drekes 06-26-2010 09:07

Re: Need help with cs_get_user_team
 
Quote:

Originally Posted by Devil259 (Post 1220347)
You included two times fakemeta.. :oops:

And 2 times amxmodx and 2 times hamsandwich


All times are GMT -4. The time now is 14:45.

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