AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   2 Malfunctioning Plugins on CS server (https://forums.alliedmods.net/showthread.php?t=29374)

Throstur 06-04-2006 10:24

2 Malfunctioning Plugins on CS server
 
First off, modules:

Code:

name                    version  author             
Fun                    1.71    AMX Mod X Dev Team 
Engine                  1.71    AMX Mod X Dev Team 
FakeMeta                1.71    AMX Mod X Dev Team 
nVault                  1.71    AMX Mod X Dev Team 
CStrike                1.71    AMX Mod X Dev Team 
CSX                    1.71    AMX Mod X Dev Team 
Sockets                1.71    HLSW Dev Team     
RegEx                  1.71    AMX Mod X Dev Team

Second off, plugins:

Code:

name              version  author            file            status 
Admin Base        1.71    AMXX Dev Team    admin.amxx      running 
Admin Commands    1.71    AMXX Dev Team    admincmd.amxx    running 
Admin Help        1.71    AMXX Dev Team    adminhelp.amxx  running 
Slots Reservation  1.71    AMXX Dev Team    adminslots.amxx  running 
Multi-Lingual Sys  1.71    AMXX Dev Team    multilingual.am  running 
Menus Front-End    1.71    AMXX Dev Team    menufront.amxx  running 
Commands Menu      1.71    AMXX Dev Team    cmdmenu.amxx    running 
Players Menu      1.71    AMXX Dev Team    plmenu.amxx      running 
Maps Menu          1.71    AMXX Dev Team    mapsmenu.amxx    running 
Admin Chat        1.71    AMXX Dev Team    adminchat.amxx  running 
Anti Flood        1.71    AMXX Dev Team    antiflood.amxx  running 
Scrolling Message  1.71    AMXX Dev Team    scrollmsg.amxx  running 
Info. Messages    1.71    AMXX Dev Team    imessage.amxx    running 
Admin Votes        1.71    AMXX Dev Team    adminvote.amxx  running 
NextMap            1.71    AMXX Dev Team    nextmap.amxx    running 
Nextmap Chooser    1.71    AMXX Dev Team    mapchooser.amxx  running 
TimeLeft          1.71    AMXX Dev Team    timeleft.amxx    running 
Pause Plugins      1.71    AMXX Dev Team    pausecfg.amxx    running 
Stats Configurati  1.71    AMXX Dev Team    statscfg.amxx    running 
StatsX            1.71    AMXX Dev Team    statsx.amxx      running 
amx_respawn        0.9.4    f117bomb          GHW_respawn.amx  debug   
unknown            unknown  unknown          peace.amxx      bad load
AMX SO SEE ME      1.0      Suicid3          invis.amxx      running 
GHW Ultimate Puni  1.0      GHW_Chronic      GHW_USlays.amxx  running 
Timer 16 (light)  1.17    Mel              timer16.amxx    paused 
Fireworks++        2.5      Twilight Suzuka  fireworks2.amxx  running 
Basic RCON/CVAR C  1.2      GHW_Chronic      GHW_Basic_Comma  running 
Amx_Super All-In-  2.0      bmann_420/AMX(x)  amx_super.amxx  running 
surf_olympics      1.5.1    OneEyed          surf_olympics.a  running 
AMX Bank          1.6      twistedeuphoria  amx_bank.amxx    running
30 plugins, 27 running

----

Now the problem plugins:

I. Respawn REPLACED

This plugin automatically respawns the player back to his/her spawn on death.
- This plugin must be capable of being deactivated and activated by a command in-game, by admin.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("amx_respawn","0.9.4","f117bomb")     register_event("DeathMsg","death_msg","a")     register_event("ShowMenu","team_select","b","4&Team_Select")     register_event("VGUIMenu","team_select","b","1=2")     register_cvar("amx_respawn","0")     register_cvar("amx_respawn_safetytime","3")     register_menucmd(register_menuid("Terrorist_Select",1), 511,"team_select")     register_menucmd(register_menuid("CT_Select",1),511,"team_select")     register_clcmd("joinclass","team_select") } public team_select(id) {     if(get_cvar_num("amx_respawn"))     {         set_task(1.6,"respawn",id)     } } public death_msg() {     new id=read_data(2)     new team[32]     get_user_team(id,team,31)     if(get_cvar_num("amx_respawn") && containi(team,"spec")==-1)       {         spawn(id)         set_task(0.6,"respawn",id)         set_task(0.7,"respawn2",id)     } } public respawn(id) {     spawn(id) } public respawn2(id) {     spawn(id)     set_user_health(id,230500)     set_task(get_cvar_float("amx_respawn_safetytime"),"health",id)     client_print(id,print_chat,"[AMXX] You are invincible for %d seconds.",get_cvar_num("amx_respawn_safetytime"))     set_user_rendering(id,kRenderFxGlowShell,0,255,0,kRenderTransAlpha,255) } public health(id) {     set_user_health(id,100)     client_print(id,print_chat,"[AMXX] You are no longer invincible.")     set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255) }

This one loads, but does not work. If amx_respawn 1 is done in console then it's an unknown command. If the same command is done through rcon, the client is overflowed on death, and kicked.

---

II. Peace Plugin

This plugin allows the player to say /peace to activate peace mode. Peace mode ensures that the player cannot be killed by another player but also that the player cannot kill/hurt others.
- This plugin must be capable of being deactivated and activated by a command in-game, by admin.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> new bool:has_peace[33] new bool:want_peace[33] new givebackinfo[33][43] new togglecvar public plugin_init() {     register_plugin("Peace Mode","1.0","GHW_Chronic")     register_clcmd("say /peace","say_hook")     register_clcmd("say_team /peace","say_hook")     if(is_running("cstrike") || is_running("czero")) register_event("DeathMsg","DeathMsg","a")     togglecvar = register_cvar("peace_enabled","1")     register_event("ResetHUD","spawned","b") } public say_hook(id) {     if(want_peace[id])     {         set_user_godmode(id,0)         has_peace[id] = false         want_peace[id] = false         client_print(id,print_chat,"[AMXX] Peace mode disabled, say /peace to enable again.")     }     else     {         if(get_pcvar_num(togglecvar))         {             want_peace[id]=true             client_print(id,print_chat,"[AMXX] Peace mode will enable on you next round / spawn.")         }         else         {             client_print(id,print_chat,"[AMXX] Peace mode plugin has been toggled off.")         }     } } public spawned(id) {     if(id>32 || !id)     {         return PLUGIN_CONTINUE     }     if(!is_user_alive(id) || !want_peace[id])     {         return PLUGIN_CONTINUE     }     if(!get_pcvar_num(togglecvar))     {         set_user_godmode(id,0)         has_peace[id] = false         want_peace[id] = false         client_print(id,print_chat,"[AMXX] Peace mode plugin was disabled.")         return PLUGIN_CONTINUE     }     if(has_peace[id])     {         set_user_deaths(id,get_user_deaths(id) - 1)         set_user_frags(id,get_user_frags(id) + 1)         giveback(givebackinfo[id],id)     }     set_user_godmode(id,1)     has_peace[id] = true     client_print(id,print_chat,"[AMXX] Peace mode enabled, say /peace to disable it.")     if(is_running("cstrike") || is_running("czero"))     {         client_cmd(id,"weapon_c4")         set_task(0.1,"dropit",id)     }     return PLUGIN_CONTINUE } public dropit(id) {     client_cmd(id,"drop") } public DeathMsg(id) {     new T, T2, CT, CT2     for(new i=1;i<=get_maxplayers();i++)     {         if(is_user_alive(i))         {             if(get_user_team(i)==1) T++             if(get_user_team(i)==1 && !has_peace[id]) T2++             if(get_user_team(i)==2) CT++             if(get_user_team(i)==2 && !has_peace[id]) CT2++         }     }     if(!CT2 && CT)     {         new weapons[32], num, weapon, clip, ammo, origin[3], Float:velocity[3]         for(new i=1;i<=32;i++)         {             if(is_user_alive(id) && has_peace[id] && get_user_team(i)==2)             {                 get_user_weapons(id,weapons,num)                 weapon = get_user_weapon(id,clip,ammo)                 get_user_origin(id,origin)                 get_user_velocity(id,velocity)                 for(new i2=0;i2<=31;i2++)                 {                     givebackinfo[i][i2] = weapons[i2]                 }                 givebackinfo[i][32] = weapon                 givebackinfo[i][33] = clip                 givebackinfo[i][34] = ammo                 givebackinfo[i][35] = origin[0]                 givebackinfo[i][36] = origin[1]                 givebackinfo[i][37] = origin[2]                 givebackinfo[i][38] = floatround(velocity[0])                 givebackinfo[i][39] = floatround(velocity[1])                 givebackinfo[i][40] = floatround(velocity[2])                 givebackinfo[i][41] = get_user_button(id)                 givebackinfo[i][42] = get_user_oldbutton(id)                 user_kill(id)             }         }     }     if(!T2 && T)     {         new weapons[32], num, weapon, clip, ammo, origin[3], Float:velocity[3]         for(new i=1;i<=32;i++)         {             if(is_user_alive(id) && has_peace[id] && get_user_team(i)==1)             {                 get_user_weapons(id,weapons,num)                 weapon = get_user_weapon(id,clip,ammo)                 get_user_origin(id,origin)                 get_user_velocity(id,velocity)                 for(new i2=0;i2<=31;i2++)                 {                     givebackinfo[i][i2] = weapons[i2]                 }                 givebackinfo[i][32] = weapon                 givebackinfo[i][33] = clip                 givebackinfo[i][34] = ammo                 givebackinfo[i][35] = origin[0]                 givebackinfo[i][36] = origin[1]                 givebackinfo[i][37] = origin[2]                 givebackinfo[i][38] = floatround(velocity[0])                 givebackinfo[i][39] = floatround(velocity[1])                 givebackinfo[i][40] = floatround(velocity[2])                 givebackinfo[i][41] = get_user_button(id)                 givebackinfo[i][42] = get_user_oldbutton(id)                 user_kill(id)             }         }     } } public giveback(param[43],id) {     give_weapons(id,param)     give_ammo(id,param)     give_ammo(id,param)     give_ammo(id,param)     set_outweapon(id,param[32])     new origin[3]     origin[0] = param[35]     origin[1] = param[36]     origin[2] = param[37]     new Float:velocity[3]     velocity[0] = float(param[38])     velocity[1] = float(param[39])     velocity[2] = float(param[40])     set_user_origin(id,origin)     set_user_velocity(id,velocity)     entity_set_int(id,EV_INT_button,param[41])     entity_set_int(id,EV_INT_oldbuttons,param[42]) } stock set_outweapon(id,weapon) {     switch(weapon)     {         case 1: client_cmd(id,"weapon_p228")         case 3: client_cmd(id,"weapon_scout")         case 4: client_cmd(id,"weapon_hegrenade")         case 5: client_cmd(id,"weapon_xm1014")         case 6: client_cmd(id,"weapon_c4")         case 7: client_cmd(id,"weapon_mac10")         case 8: client_cmd(id,"weapon_aug")         case 9: client_cmd(id,"weapon_smokegrenade")         case 10: client_cmd(id,"weapon_elite")         case 11: client_cmd(id,"weapon_fiveseven")         case 12: client_cmd(id,"weapon_ump45")         case 13: client_cmd(id,"sg550")         case 14: client_cmd(id,"weapon_galil")         case 15: client_cmd(id,"weapon_famas")         case 16: client_cmd(id,"weapon_usp")         case 17: client_cmd(id,"weapon_glock18")         case 18: client_cmd(id,"weapon_awp")         case 19: client_cmd(id,"weapon_mp5navy")         case 20: client_cmd(id,"weapon_m249")         case 21: client_cmd(id,"weapon_m3")         case 22: client_cmd(id,"weapon_m4a1")         case 23: client_cmd(id,"weapon_tmp")         case 24: client_cmd(id,"weapon_g3sg1")         case 25: client_cmd(id,"weapon_flashbang")         case 26: client_cmd(id,"weapon_deagle")         case 27: client_cmd(id,"weapon_sg552")         case 28: client_cmd(id,"weapon_ak47")         case 29: client_cmd(id,"weapon_knife")         case 30: client_cmd(id,"weapon_p90")     } } stock give_weapons(id,param[43]) {     for(new i=0;i<=31;i++)     {         switch(param[i])         {             case 1: give_item(id,"weapon_p228")             case 3: give_item(id,"weapon_scout")             case 4: give_item(id,"weapon_hegrenade")             case 5: give_item(id,"weapon_xm1014")             case 6: give_item(id,"weapon_c4")             case 7: give_item(id,"weapon_mac10")             case 8: give_item(id,"weapon_aug")             case 9: give_item(id,"weapon_smokegrenade")             case 10: give_item(id,"weapon_elite")             case 11: give_item(id,"weapon_fiveseven")             case 12: give_item(id,"weapon_ump45")             case 13: give_item(id,"sg550")             case 14: give_item(id,"weapon_galil")             case 15: give_item(id,"weapon_famas")             case 16: give_item(id,"weapon_usp")             case 17: give_item(id,"weapon_glock18")             case 18: give_item(id,"weapon_awp")             case 19: give_item(id,"weapon_mp5navy")             case 20: give_item(id,"weapon_m249")             case 21: give_item(id,"weapon_m3")             case 22: give_item(id,"weapon_m4a1")             case 23: give_item(id,"weapon_tmp")             case 24: give_item(id,"weapon_g3sg1")             case 25: give_item(id,"weapon_flashbang")             case 26: give_item(id,"weapon_deagle")             case 27: give_item(id,"weapon_sg552")             case 28: give_item(id,"weapon_ak47")             case 29: give_item(id,"weapon_knife")             case 30: give_item(id,"weapon_p90")         }     } } stock give_ammo(id,param[43]) {     for(new i=0;i<=31;i++)     {         switch(param[i])         {             case 1: give_item(id,"ammo_357sig")             case 3: give_item(id,"ammo_762nato")             case 5: give_item(id,"weapon_xm1014")             case 7: give_item(id,"ammo_45acp")             case 8: give_item(id,"ammo_556nato")             case 10: give_item(id,"ammo_9mm")             case 11: give_item(id,"ammo_57mm")             case 12: give_item(id,"ammo_45acp")             case 13: give_item(id,"ammo_556nato")             case 14: give_item(id,"556nato")             case 15: give_item(id,"ammo_556nato")             case 16: give_item(id,"ammo_45acp")             case 17: give_item(id,"ammo_9mm")             case 18: give_item(id,"ammo_338magnum")             case 19: give_item(id,"ammo_9mm")             case 20: give_item(id,"ammo_556nato")             case 21: give_item(id,"weapon_m3")             case 22: give_item(id,"ammo_556nato")             case 23: give_item(id,"ammo_9mm")             case 24: give_item(id,"ammo_762nato")             case 26: give_item(id,"ammo_50ae")             case 27: give_item(id,"ammo_556nato")             case 28: give_item(id,"ammo_762nato")             case 30: give_item(id,"ammo_57mm")         }     } } public client_PreThink(id) {     if(!is_user_alive(id) || !has_peace[id] || !get_pcvar_num(togglecvar))     {         return PLUGIN_CONTINUE     }     entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) - IN_ATTACK)     entity_set_int(id,EV_INT_oldbuttons,entity_get_int(id,EV_INT_oldbuttons) - IN_ATTACK)     return PLUGIN_CONTINUE }

This plugin doesnt even load, bad load.
Tried with 3 different compilers.

Server console:

Quote:

L 06/04/2006 - 16:43:46: [AMXX] Plugin "peace.amxx" failed to load: Plugin uses an unknown function (name "set_user_deaths") - check your modules.ini.

rain 06-05-2006 06:21

In response to your PM.

Apparently, I'm not sure of the things I am to write (no working test bed server to verify it).

Regarding amx_respawn:
Quote:

If amx_respawn 1 is done in console then it's an unknown command. If the same command is done through rcon, the client is overflowed on death, and kicked.
There is no console command registered. Try using 'amx_cvar amx_respawn 1'. As to the overflow problem - I don't really know, it's a guess, try trashing this line: 'set_user_health(id,230500)'. (Oh, I would like to be so healthy.) If it doesn't help, then there's some more severe problem around.

And with the second:
Replace 'set_user_deaths' with 'cs_set_user_deaths' and try once more.

Don't know though if it suffices.

Throstur 06-12-2006 18:21

^bump^

Brad 06-12-2006 19:09

Locked for being (a) bumped and (b) inappropriately posted. If you have an issue with a specific plugin, or in your case two plugins, post in their threads.


All times are GMT -4. The time now is 16:29.

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