AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   run time errors (https://forums.alliedmods.net/showthread.php?t=12391)

Belsebub 04-14-2005 13:27

run time errors
 
im working on a hidden mod requested from Gangsta Bear, and now i tested it for the first time and i get some errors:

Code:

L 04/14/2005 - 18:30:37: [AMXX] Native error in "cs_get_user_team" on line 57 (file "hidden.sma").
L 04/14/2005 - 18:30:37: [CStrike] Player out of range (0)
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:31:00: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
L 04/14/2005 - 18:35:14: [AMXX] Run time error 3 (stack error) on line 108 (file "hidden.sma").
SZ_GetSpace: overflow on Client Datagram
WARNING: msg overflowed for Belsebub
L 04/14/2005 - 18:35:20: [AMXX] Native error in "cs_get_user_team" on line 57 (file "hidden.sma").
L 04/14/2005 - 18:35:20: [CStrike] Player out of range (0)

and when i add a bot i says:

Fatal error - Dedicated server
ED_Alloc: no free edicts

and crashes

hope someone can help me with the code and tell me if i can do anything better,
and i need to know where to add !is_user_alive(id) and !is_user_connected(id) checks, if i need any

heres the code:

Code:
 /*AMX Mod X script. Copyright (C) 2005 Belsebub The Hidden Mod comes with ABSOLUTELY NO WARRANTY. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  CREDITS  =======  Request By Gangsta Bear  BunnyHop Code From CheesyPeteza's BunnyHop Plugin  */  #include <amxmodx>  #include <amxmisc>  #include <fun>  #include <cstrike>  #include <engine>  //----------------------------------------------------------------------------------------------  new bool:Hidden[33] = false  new bool:IRIS[33] = false  new bool:Shotgun[33] = false  new bool:SMG[33] = false  new HiddenCount = 0  //----------------------------------------------------------------------------------------------  public plugin_init() {     register_plugin("The Hidden Mod","0.1","Belsebub")     //MENUS     register_menucmd(register_menuid("Hidden Menu:"),1023,"ActionMenu")     register_menucmd(register_menuid("Weapon Menu:"),1023,"ActionWeaponMenu")     //COMMANDS     register_clcmd("say /hiddenmenu","ShowMenu")     register_clcmd("say_team /hiddenmenu","ShowMenu")     //EVENTS     register_event("DeathMsg","Event_Death","a","2!0")     register_logevent("StartRound",2,"1=Round_Start")     register_event("ResetHUD", "Event_Resethud", "b")     register_event("CurWeapon", "Check_Speed", "be")     register_event("Damage", "Event_Damage", "b", "2!0")     register_event("TextMsg","Event_Hiddenbuy","b","2=#Cannot_Buy_This")     register_event("TextMsg","Event_Hiddenbuy","b","2=#Cant_buy")     register_event("TextMsg","Event_Hiddenbuy","b","2=#CT_cant_buy")     register_event("TextMsg","Event_Hiddenbuy","b","2=#Terrorist_cant_buy")  }  //----------------------------------------------------------------------------------------------  public plugin_precache() {     Disable_Buyzone()  }  //----------------------------------------------------------------------------------------------  public StartRound(id) {     new CsTeams:team = cs_get_user_team(id)     new players = get_playersnum(0)     new iPlayers[32], iNum = get_players( iPlayers, iNum )     if (HiddenCount == 0 && players >= 3) {         id = iPlayers[ random_num(0, iNum-1) ]         client_print(0, print_chat, "Randomly choosing a hidden")         Hidden[id] = true         HiddenCount++         return PLUGIN_CONTINUE         } else if (Hidden[id] == true && team == CS_TEAM_T) {         cs_set_user_team(id, CS_TEAM_CT, CS_CT_GIGN)         return PLUGIN_CONTINUE         } else if (IRIS[id] == true && team == CS_TEAM_CT){         cs_set_user_team(id, CS_TEAM_T, CS_T_ARCTIC)         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Resethud(id) {     if (Hidden[id] == true) {         set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,15)         set_user_health(id,250)         set_user_armor(id, 100)         set_user_maxspeed(id, 480.0)         give_item(id, "weapon_hegrenade")         give_item(id, "weapon_hegrenade")         client_print(id, print_center, "You Are The Hidden")         return PLUGIN_CONTINUE         } else if (IRIS[id] == true) {         if (Shotgun[id] == true) {             give_item(id, "weapon_m3")             cs_set_user_bpammo(id, CSW_M3, 24)             return PLUGIN_CONTINUE             } else if (SMG[id] == true) {             give_item(id, "weapon_p90")             cs_set_user_bpammo(id, CSW_P90, 50)             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Check_Speed(id) {     new clip, ammo     new weapon = get_user_weapon(id,clip,ammo)     if(Hidden[id] == true) {         set_user_maxspeed(id, 480.0)         if (weapon == CSW_KNIFE || weapon == CSW_HEGRENADE) {             return PLUGIN_CONTINUE             } else {             client_cmd(id,"weapon_knife")             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Disable_Buyzone() {     new ent = find_ent_by_class(-1,"info_map_parameters")     if(!ent) {         ent = create_entity("info_map_parameters")     }     DispatchKeyValue(ent,"buying","3")     DispatchSpawn(ent)  }  //----------------------------------------------------------------------------------------------  public Event_Hiddenbuy(id) {     client_print(id,print_center,"No buying - Hidden mod is on!")  }  //----------------------------------------------------------------------------------------------  public client_PreThink(id) {     if(Hidden[id] == true) {         entity_set_float(id, EV_FL_fuser2, 0.0)         if (entity_get_int(id, EV_INT_button) & 2)         {             new flags = entity_get_int(id, EV_INT_flags)             if (flags & FL_WATERJUMP)             return PLUGIN_CONTINUE             if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )             return PLUGIN_CONTINUE             if ( !(flags & FL_ONGROUND) )             return PLUGIN_CONTINUE             new Float:velocity[3]             entity_get_vector(id, EV_VEC_velocity, velocity)             velocity[2] += 250.0             entity_set_vector(id, EV_VEC_velocity, velocity)             entity_set_int(id, EV_INT_gaitsequence, 6)         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ShowMenu(id) {     new szMenuBody[512]     new keys     new len = format(szMenuBody, 511, "\yHidden Menu:^n" )     len += format( szMenuBody[len], 511-len, "^n\w1. Change Weapon (IRIS Only)" )     len += format( szMenuBody[len], 511-len, "^n\w2. Exit" )     keys = (1<<0|1<<1)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //--------------------------------------------------------------------------------------------  public ActionMenu(id,key) {     switch(key)     {         case 0:         {             ShowWeaponMenu(id)             return PLUGIN_CONTINUE         }         case 1:         {             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public ShowWeaponMenu(id) {     if(IRIS[id] != true) {         client_print(id, print_center, "Only IRIS Can Change There Weapons.")         return PLUGIN_CONTINUE     }     new szMenuBody[512]     new keys     new len = format(szMenuBody, 511, "\yWeapon Menu:^n" )     len += format( szMenuBody[len], 511-len, "^n\w1. Shotgun" )     len += format( szMenuBody[len], 511-len, "^n\w2. SMG" )     len += format( szMenuBody[len], 511-len, "^n\w3. Exit" )     keys = (1<<0|1<<1|1<<2)     show_menu( id, keys, szMenuBody, -1 )     return PLUGIN_CONTINUE  }  //--------------------------------------------------------------------------------------------  public ActionWeaponMenu(id,key) {     switch(key)     {         case 0:         {             give_item(id, "weapon_m3")             cs_set_user_bpammo(id, CSW_M3, 24)             Shotgun[id] = true             return PLUGIN_CONTINUE         }         case 1:         {             give_item(id, "weapon_p90")             cs_set_user_bpammo(id, CSW_P90, 50)             SMG[id] = true             return PLUGIN_CONTINUE         }         case 2:         {             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public client_disconnect(id) {     if (Hidden[id] == true) {         Hidden[id] = false         HiddenCount--     }     IRIS[id] = false     SMG[id] = false     Shotgun[id] = false     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public client_connect(id) {     Hidden[id] = false     IRIS[id] = true     SMG[id] = true     Shotgun[id] = false     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public client_putinserver (id)  {     set_task ( 20.0, "hidden_help" )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Death(id) {     new killer = read_data(1)     new victim = read_data(2)     if (IRIS[killer] == true && Hidden[victim] == true) {         Hidden[victim] = false         set_user_rendering(victim, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255)         Hidden[killer] = true         return PLUGIN_CONTINUE         } else if (IRIS[killer] == true && IRIS[victim] == true) {         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public  hidden_help (id) {     client_print ( 0, print_chat, "Type /hiddenmenu to bring up the hidden menu." )     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------  public Event_Damage(victim) {     new weapon, bodypart, attacker = get_user_attacker(victim,weapon,bodypart)     new damage = read_data(2)     new victimhealth = get_user_health(victim)     if (attacker == 0)     return PLUGIN_CONTINUE     if (attacker == victim && weapon == 0)     return PLUGIN_CONTINUE     if(weapon == CSW_HEGRENADE) {         damage = floatround(float(damage) * 1.5)         if (damage>35 && victimhealth>35)         damage=25+random_num(0,10)     }     if (weapon == CSW_KNIFE)     damage = floatround(float(damage)*2.0)     if (victimhealth - damage<=15){         set_user_health(victim,random_num(1,victimhealth))     }     return PLUGIN_CONTINUE  }  //----------------------------------------------------------------------------------------------

Belsebub 04-16-2005 05:38

sorry for doubleposting but is anyone working on it?

XxAvalanchexX 04-16-2005 12:26

I'm guessing the errors on cs_get_user_team is because you have StartRound(id), and your function comes from register_logevent, which doesn't pass an ID to a function. Basically, your StartRound function happens once a round globally, not once for every player, so there is no "id" parameter to it.

Belsebub 04-16-2005 13:26

and how to fix that?

v3x 04-16-2005 16:50

http://amxmodx.org/funcwiki.php?go=func&id=26

XxAvalanchexX 04-16-2005 17:27

Quote:

Originally Posted by v3x
http://amxmodx.org/funcwiki.php?go=func&id=26

ggh4x that doesn't help him at all, v3x!

I have no idea what you are trying to accomplish so I can't tell you how to fix it.

v3x 04-16-2005 17:31

ggh4x to you too. I was merely suggesting an alternative (If that could be used in his situation), or maybe I read it wrong again.

ggh4x :stupid:

Belsebub 04-17-2005 02:18

i just want to get thoose errors away

XxAvalanchexX 04-17-2005 02:56

I know, but I can't attempt to fix your code if I don't know what your code is supposed to do.

Belsebub 04-17-2005 03:03

when freezetime is over i want to randomly choose a hidden if hidden count is 0 and if there are 3 or more players in the server, and if the hidden is on the terrorist team i want it to transfer the hidden to the ct's,
and if the player is iris i want it to transfer it to the terrorists if its on the ct's

and when they spawn i want the hidden to be almost invisible and get 250hp,100armor,480 speed and 2 grenades

and iris gets a m3, and ammo if shotgun is true and a p90 and ammo if smg is true

that explains the StartRound(id) and Event_Resethud(id)


All times are GMT -4. The time now is 09:54.

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