View Full Version : Need help with cs_get_user_team
BloodMan
06-26-2010, 04:28
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.
#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;
}
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
Thanks.
Thanks.
You do know that
!is_user_alive(id)
Is for dead players right?
You do know that
!is_user_alive(id)Is for dead players right?
Didn't notice that :oops:
Didn't notice that :oops:
Lol I was talking to BloodMan -.-
well, since he is returning when a player is dead. I assume he knows it.
if( !is_user_alive(id) )
{
FirstSpawn[id] = true
return
}
RedRobster
06-26-2010, 08:07
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
How to make so that this menu would only work for terrorist team?
#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:
You included two times fakemeta.. :oops:
And 2 times amxmodx and 2 times hamsandwich
BloodMan
06-26-2010, 10:40
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.
#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;
}
RedRobster
06-26-2010, 11:11
Note: I didn't check the entire code, I only added what he wanted and changed 2 things from fakemeta to fun (gravity and health).
#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) //You put &% for some reason
{
FirstSpawn[id] = true
return
}
if( !(get_user_flags(id) & ADMIN_LEVEL_H) ) //Sees if they have the right admin
return
FirstSpawn[id] = false
new menu = menu_create("Zombiu VIP Meniu:", "vip_menu");
menu_additem(menu ,"Daugiau Sveikatos", "1");
menu_additem(menu ,"Greitas Begimas", "2");
menu_additem(menu ,"Gravitacija", "3");
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:
{
set_user_health( id, get_user_health( id ) + 1500 ); //Switched from fakemeta to fun
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:
{
set_user_gravity( id, 0.5 ); //Switched from fakemeta to fun
client_print(id, print_chat, "O dabar sokinesi kaip kengura!");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
Is that your entire code? Cause if it is you're registering prethink and not using it. And i don't think you use fakemeta_util
RedRobster
06-26-2010, 11:17
He's not using The round start logevent either, so I don't think this is his entire code.
BloodMan
06-27-2010, 02:44
this is the entire code.
edgaras85
06-27-2010, 05:12
He's not using The round start logevent either, so I don't think this is his entire code.
No i think its entire code, but he dont know what they doing because he copied from other codes....
RedRobster
06-27-2010, 06:35
If that is your entire code...then here:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <cstrike>
new bool:FirstSpawn[33]
public plugin_init()
{
RegisterHam (Ham_Spawn, "player", "Player_Spawn", 1)
}
public Player_Spawn(id)
{
if( !is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T) //You put &% for some reason
{
FirstSpawn[id] = true
return
}
if( !(get_user_flags(id) & ADMIN_LEVEL_H) ) //Sees if they have the right admin
return
FirstSpawn[id] = false
new menu = menu_create("Zombiu VIP Meniu:", "vip_menu");
menu_additem(menu ,"Daugiau Sveikatos", "1");
menu_additem(menu ,"Greitas Begimas", "2");
menu_additem(menu ,"Gravitacija", "3");
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:
{
set_user_health( id, get_user_health( id ) + 1500 ); //Switched from fakemeta to fun
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:
{
set_user_gravity( id, 0.5 ); //Switched from fakemeta to fun
client_print(id, print_chat, "O dabar sokinesi kaip kengura!");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.