Raised This Month: $ Target: $400
 0% 

i need help i don't know whats wrong!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-31-2006 , 20:49   i need help i don't know whats wrong!
Reply With Quote #1

guys could someone help me please i realy don't know whats the problem the plugin compiles fine but when i join game it kicks me out "reliable over chan load or something" and it in the logs it asked me for debug and i added it but it keeps kicking me but not it saying i have something wrong with my give_item functions here is the hole code to see
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> #include <fun> #include <cstrike> new const g_Weapons[26][20] = {    "weapon_usp",  "weapon_glock18",  "weapon_deagle",  "weapon_p228",  "weapon_elite",  "weapon_fiveseven",  "weapon_m3",  "weapon_xm1014",  "weapon_mp5navy",  "weapon_tmp",  "weapon_p90",  "weapon_mac10",  "weapon_ump45",  "weapon_famas",  "weapon_sg552",  "weapon_ak47",  "weapon_m4a1",  "weapon_aug",  "weapon_scout",  "weapon_awp",  "weapon_g3sg1",  "weapon_sg550",  "weapon_galil",  "weapon_m249",  "weapon_hegrenade",  "weapon_knife" } new const g_Ammos[26][20] = {    "ammo_45acp",  "ammo_9mm",  "ammo_50ae",  "ammo_357sig",  "ammo_9mm",  "ammo_57mm",  "ammo_buckshot",  "ammo_buckshot",  "ammo_9mm",  "ammo_9mm",  "ammo_57mm ",  "ammo_45acp",  "ammo_45acp",  "ammo_556nato",  "ammo_556nato",  "ammo_762nato",  "ammo_556nato",  "ammo_556nato",  "ammo_762nato",  "ammo_338magnum",  "ammo_762nato",  "ammo_556nato",    "ammo_556nato",  "ammo_556natobox",  "",  "" } new const g_Models[26][20] = {    "w_usp",  "w_glock18",  "w_deagle",  "w_p228",  "w_elite",  "w_fiveseven",  "w_m3",  "w_xm1014",  "w_mp5navy",  "w_tmp",  "w_p90",  "w_mac10",  "w_ump45",  "w_famas",  "w_sg552",  "w_ak47",  "w_m4a1",  "w_aug",  "w_scout",  "w_awp",  "w_g3sg1",  "w_sg550",  "w_galil",  "w_m249",  "w_hegrenade",  "w_knife" } new g_level[33] new enabled new Spawn_Time   public plugin_init() {  register_plugin("GunGame Mod","0.1","K007")    enabled = register_cvar("ggm_enabled","0")  Spawn_Time = register_cvar("ggm_spawntime","15")    register_concmd("ggm_active","Activation",0, " - ggm_active <1|0> 1 active, 0 desactive")    register_event("HLTV", "New_Round", "a", "1=0", "2=0")    register_event("DeathMsg","Death","a")  register_event("ResetHUD", "Player_Respawn", "b")  register_event("StatusIcon", "BuyZone", "be", "1=1", "1=2", "2=buyzone")    register_clcmd("drop","itemDrop")          set_task(30.0, "cleanup", 0, "", 0, "b")   } public cleanup(id) {  if(get_pcvar_num(enabled) == 1)  {   new ent   ent = entity_count()   client_print(0, print_chat, "[GunGameMod] %d Total Entites Are Found", ent)     new curent   curent = entity_count()   new ent1 = -1, ent2   new str[32], find[32], found   while(ent1)   {    ent1 = find_ent_by_class(ent1, "weaponbox")    if(ent1)    {     entity_get_string(ent1, EV_SZ_model, str, 32)     if(equali(str, "models/w_knife.mdl")){      copy(find, 32, "weapon_knife")     }     if(equali(str, "models/w_usp.mdl")){      copy(find, 32, "weapon_usp")     }     if(equali(str, "models/w_glock18.mdl")){      copy(find, 32, "weapon_glock18")     }     if(equali(str, "models/w_deagle.mdl")){      copy(find, 32, "weapon_deagle")     }     if(equali(str, "models/w_p228.mdl")){      copy(find, 32, "weapon_p228")     }     if(equali(str, "models/w_elite.mdl")){      copy(find, 32, "weapon_elite")     }     if(equali(str, "models/w_fiveseven.mdl")){      copy(find, 32, "weapon_fiveseven")     }     if(equali(str, "models/w_m3.mdl")){      copy(find, 32, "weapon_m3")     }     if(equali(str, "models/w_xm1014.mdl")){      copy(find, 32, "weapon_xm1014")     }     if(equali(str, "models/w_mp5.mdl")){      copy(find, 32, "weapon_mp5navy")     }     if(equali(str, "models/w_tmp.mdl")){      copy(find, 32, "weapon_tmp")     }     if(equali(str, "models/w_p90.mdl")){      copy(find, 32, "weapon_p90")     }     if(equali(str, "models/w_mac10.mdl")){      copy(find, 32, "weapon_mac10")     }     if(equali(str, "models/w_ump45.mdl")){      copy(find, 32, "weapon_ump45")     }     if(equali(str, "models/w_ak47.mdl")){      copy(find, 32, "weapon_ak47")     }     if(equali(str, "models/w_sg552.mdl")){      copy(find, 32, "weapon_sg552")     }     if(equali(str, "models/w_m4a1.mdl")){      copy(find, 32, "weapon_m4a1")     }     if(equali(str, "models/w_aug.mdl")){      copy(find, 32, "weapon_aug")     }     if(equali(str, "models/w_scout.mdl")){      copy(find, 32, "weapon_scout")     }     if(equali(str, "models/w_awp.mdl")){      copy(find, 32, "weapon_awp")     }     if(equali(str, "models/w_g3sg1.mdl")){      copy(find, 32, "weapon_g3sg1")     }     if(equali(str, "models/w_sg550.mdl")){      copy(find, 32, "weapon_sg550")     }     if(equali(str, "models/w_m249.mdl")){      copy(find, 32, "weapon_m249")     }     if(equali(str, "models/w_famas.mdl")){      copy(find, 32, "weapon_famas")     }     if(equali(str, "models/w_galil.mdl")){      copy(find, 32, "weapon_galil")     }     if(equali(str, "models/w_shield.mdl")){      copy(find, 32, "weapon_shield")     }     if(equali(str, "models/w_c4.mdl")){      copy(find, 32, "weapon_c4")     }     if(equali(str, "models/w_flashbang.mdl")){      copy(find, 32, "weapon_flashbang")     }     if(equali(str, "models/w_hegrenade.mdl")){      copy(find, 32, "weapon_hegrenade")     }     if(equali(str, "models/w_smokegrenade.mdl")){      copy(find, 32, "weapon_smokegrenade")     }     if(equali(str, "models/w_thighpack.mdl")){      copy(find, 32, "item_thighpack")     }     if(equali(str, "models/w_kevlar.mdl")){      copy(find, 32, "item_kevlar")     }     if(equali(str, "models/w_assault.mdl")){      copy(find, 32, "item_assaultsuit")     }     if(equali(str, "models/w_medkit.mdl")){      copy(find, 32, "item_healthkit")     }     if(equali(str, "models/w_battery.mdl")){      copy(find, 32, "item_battery")     }     if(equali(str, "models/w_longjump.mdl")){      copy(find, 32, "item_longjump")     }     ent2 = -1     found = 0     while(ent2){      ent2 = find_ent_by_owner(ent2, find, ent1)      if(ent2){       found = 1       remove_entity(ent2)      }     }     if(found){      remove_entity(ent1)     }    }   }   new diff   diff = curent   curent = entity_count()   diff = diff - curent     client_print(0, print_chat, "[GunGameMod] Removed %d Entities | Total: %d", diff, curent)  } } public Activation(id) {  if(is_user_admin(id))  {     new  argv[32]   read_argv(1,argv,32)     if(equali(argv,"0",1))   {        set_hudmessage(225, 0, 0, 0.31, 0.26, 0, 6.0, 12.0, 0.01, 0.1, 2)    show_hudmessage(0,"GunGame Mod Has Been Deactivated....")        set_pcvar_num(enabled, 0)    server_cmd("sv_restartround 5")   }   else if(equali(argv,"1",1))   {    set_hudmessage(85, 255, 85, 0.31, 0.26, 0, 6.0, 12.0, 0.01, 0.1, 2)    show_hudmessage(0,"GunGame Mod Has Been Activated!!!!")        set_pcvar_num(enabled, 1)    server_cmd("sv_restartround 2")        g_level[id] = 0       }   else   {    console_print(id, "ggm_active <1|0> --- 1 active, 0 desactive")   }  }    else  {   console_print(id, "[AMXX] You have no access to that commmand!")  }    return PLUGIN_CONTINUE } public Death() {  new killer = read_data(1)  new victim = read_data(2)      if(get_pcvar_num(enabled) == 1 && get_pcvar_num(Spawn_Time) !=0)  {     client_print(victim, print_chat, "[GunGameMod] You Will Respawn in %s seconds", get_pcvar_num(Spawn_Time))     set_task(get_pcvar_float(Spawn_Time), "Respawn", victim)         new VicLevel = g_level[victim]     set_task(0.1,"removeWeapon", VicLevel)       strip_user_weapons(killer)     new KillaLevel = g_level[killer]     set_task(0.1,"removeWeapon", KillaLevel)     g_level[killer] = g_level[killer]+1     if(g_level[killer] > 25 )   {    g_level[killer]=25    winna(killer)   }   giveWeapon(killer)   cs_set_user_money(killer,0)     return PLUGIN_CONTINUE  }    return PLUGIN_CONTINUE } public Respawn(id) {    if(cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED)   return PLUGIN_HANDLED    if(!is_user_alive(id))   return PLUGIN_HANDLED  spawn(id)  cs_set_user_money(id, 0)    return PLUGIN_HANDLED } public BuyZone(id) {  if (!get_cvar_num("gg_active"))   return PLUGIN_CONTINUE    message_begin(MSG_ONE,get_user_msgid("StatusIcon"), {0,0,0}, id)  write_byte(0)  write_string("buyzone")  message_end()  return PLUGIN_HANDLED } public dropWeapon (id) {  new Cmd[60]    format(Cmd, 59, "drop %s", g_Weapons[g_level[id]])  client_cmd(id, Cmd)   } public giveWeapon(id) {  give_item(id, g_Weapons[g_level[id]])    if(g_level[id] < 24)  {   give_item(id, g_Ammos[g_level[id]])   give_item(id, g_Ammos[g_level[id]])   give_item(id, g_Ammos[g_level[id]])   give_item(id, g_Ammos[g_level[id]])  } } public removeWeapon(level) {  new Model[64]    format(Model, 63, "models/%s", g_Models[level])      new Weapon = engfunc(EngFunc_FindEntityByString, -1, "model", Model)  while(Weapon > 0)  {   engfunc(EngFunc_RemoveEntity, Weapon)     Weapon = engfunc(EngFunc_FindEntityByString, Weapon, "model", Model)  }    return PLUGIN_CONTINUE } public itemDrop(id) {  if(get_pcvar_num(enabled) == 1)   return PLUGIN_CONTINUE    set_task(0.2,"removeWeapon", g_level[id])    return PLUGIN_CONTINUE } public Player_Respawn(id) {  cs_set_user_money(id,0)      if (get_user_team(id) == 1)  {   engclient_cmd(id,"drop","weapon_glock18")   engclient_cmd(id,"drop","weapon_knife")   engclient_cmd(id, "drop", "weapon_c4")    }  else if (get_user_team(id) == 2)  {   engclient_cmd(id,"drop","weapon_glock18 ")   engclient_cmd(id,"drop","weapon_knife")  }    give_item(id,"item_assaultsuit")  set_task(0.1,"giveWeapon",id)    return PLUGIN_CONTINUE } public winna(id) {  new Name[33]  get_user_name(id, Name, 32)    set_user_hitzones(0,0,0)    client_print(0, print_chat, "[GunGameMod] %s Has Won The Game GG!!!!!!!", Name)    set_hudmessage(0, 0, 255, 0.2, 0.35, 0, 6.0, 12.0)  show_hudmessage(0, "[GunGameMod] %s Has Won The Game GG!", Name)    Restart() } public Restart() {    server_cmd("sv_restartround 1")  client_print(0, print_center,"[GunGameMod] Restarting in 10 seconds...")  client_print(0, print_center,"[GunGameMod] Pre-Pare to Battle")  server_cmd("sv_restartround 10")   } public New_Round(id) {  if(get_pcvar_num(enabled) == 1)  {   g_level[id] = 0     client_print(id, print_chat, "[GunGameMod] Gun Game Mod is enabled so be pre-pared and enjoy!")  }    return PLUGIN_HANDLED } public client_connect(id){  g_level[id] = 0 } public client_disconnect(id){  g_level[id] = 0 }
k007 is offline
Send a message via MSN to k007
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-31-2006 , 20:55   Re: i need help i don't know whats wrong!
Reply With Quote #2

whats in the logs after you added the dubug? and are utrying to strip weapons on a reset hud event?

Last edited by Nostrodamous; 10-31-2006 at 20:58.
Nostrodamous is offline
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-31-2006 , 20:59   Re: i need help i don't know whats wrong!
Reply With Quote #3

Code:
] gungamemod.sma::giveWeapon (line 394)
as i said it's my give item functions
k007 is offline
Send a message via MSN to k007
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-31-2006 , 21:04   Re: i need help i don't know whats wrong!
Reply With Quote #4

hmmm ive never tried giving items with a const "struct" like you did , im not sure if thats a "legel" way to do it .
Nostrodamous is offline
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-31-2006 , 21:23   Re: i need help i don't know whats wrong!
Reply With Quote #5

it's possible but i just don't know what am i doing wrong
k007 is offline
Send a message via MSN to k007
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-31-2006 , 21:45   Re: i need help i don't know whats wrong!
Reply With Quote #6

Those aren't structs, those are multi-deminsional arrays.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-31-2006 , 22:39   Re: i need help i don't know whats wrong!
Reply With Quote #7

should i make the g_level a multi-deminsional array too with lvl numbers
k007 is offline
Send a message via MSN to k007
jopmako
Senior Member
Join Date: Jul 2006
Location: QQ:331537639
Old 11-01-2006 , 01:43   Re: i need help i don't know whats wrong!
Reply With Quote #8

hmm..many bug with your code.
Code:
1:
if (!get_cvar_num("gg_active"))
should be
if (!get_cvar_num("ggm_active"))
 
2:
register_event("ResetHUD", "Player_Respawn", "b")
should be
// get alive player
register_event("ResetHUD", "Player_Respawn", "be")
 
3:
give_item(id,"item_assaultsuit")
need move to 
Player_Respawn(id)
{
give_item(id,"item_assaultsuit")
}
 
4:
public Player_Respawn(id)
{
...
...
 // set_task(0.1,"giveWeapon",id)  // player still in death status
 
 // delay more time when give item to alive player should be safely.
 set_task(0.5,"giveWeapon",id)
 
 return PLUGIN_CONTINUE 
}
 
5:
public giveWeapon(id)
{
 give_item(id, g_Weapons[g_level[id]])
 
// error give_item ammo 
 // give_item ammo must correct type with weapon
 if(g_level[id] < 24)
 {
  give_item(id, g_Ammos[g_level[id]])
  give_item(id, g_Ammos[g_level[id]])
  give_item(id, g_Ammos[g_level[id]])
  give_item(id, g_Ammos[g_level[id]])
 }
}
safely just use this 
cs_set_user_bpammo(index, weapon, amount)
 
and more...
__________________
QQ31537639

Last edited by jopmako; 11-01-2006 at 01:55.
jopmako is offline
Send a message via MSN to jopmako
Zenith77
Veteran Member
Join Date: Aug 2005
Old 11-01-2006 , 07:07   Re: i need help i don't know whats wrong!
Reply With Quote #9

To clarify, you should limit what you do in ResetHUD, if you change anything about a player it's best to set a delay on it...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 04:51.


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