 |
|
Member
Join Date: Apr 2009
Location: Brazil
|

08-07-2009
, 09:44
Re: What's wrong with my code?
|
#7
|
Really thank you guys
Alucard, thank you, but I think there is something wrong. In new round, I don't get m4a1 and either my knife get stripped.
Should I use Ham with Player Spawn + if (get_user_team(i) == 2) ?
//EDIT
I tested it with HamSandWich and it worked 
here is the code:
PHP Code:
#include <amxmodx> #include <fun> #include <hamsandwich>
#define PLUGIN "JailMod" #define VERSION "1.0" #define AUTHOR "elemeNt;"
new g_MaxPlayers
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) register_logevent("logevent_round_end", 2, "1=Round_End") g_MaxPlayers = get_maxplayers() }
public fwHamPlayerSpawnPost(iPlayer) { for(new i=1; i<=g_MaxPlayers; i++) { if(is_user_alive(i) ) { if (get_user_team(i) == 2) { strip_user_weapons(i) give_item(i,"weapon_m4a1") give_item(i,"ammo_556nato") give_item(i,"ammo_556nato") give_item(i,"ammo_556nato") give_item(i,"weapon_deagle") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"ammo_50ae") give_item(i,"weapon_knife") give_item(i,"weapon_hegrenade") } else { strip_user_weapons(i) give_item(i,"weapon_knife") } } } return PLUGIN_CONTINUE }
public logevent_round_end() { for(new i=1; i<=g_MaxPlayers; i++) { if(is_user_alive(i) ) { strip_user_weapons (i) give_item(i,"weapon_knife") } } }
Thanks to alucard and arkshine
__________________
Last edited by vermillioN25; 08-07-2009 at 10:10.
Reason: code worked
|
|
|
|