Raised This Month: $ Target: $400
 0% 

Help with features and better code. [probably fixed]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Throstur
Senior Member
Join Date: Nov 2004
Location: Iceland
Old 06-12-2006 , 13:25   Help with features and better code. [probably fixed]
Reply With Quote #1

I have a plugin which isn't good, and wont be released here (it stinks)

So basically this is what I have:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #include <fakemeta> #include <cstrike>   #define PLUGIN "Respawn" #define VERSION "1.0" #define AUTHOR "Throstur"   //new g_pMessage new g_pTrucker   new g_pMoney new g_pWeapon   public plugin_init() {               register_plugin(PLUGIN,VERSION,AUTHOR)                 //Messages //      g_pMessage = register_cvar("amx_respawn_pussy","[AMXX] Pussy.")         g_pTrucker = register_cvar("amx_respawn_trucker","[AMXX] Keep on truckin'.")           g_pMoney = register_cvar("amx_respawn_money","1000")     g_pWeapon = register_cvar("amx_respawn_weapon","glock")         register_cvar("amx_respawn_weapon_on","1")                 //Respawn         register_cvar("amx_respawn","1")         register_event("DeathMsg","fnEventDeathMsg","a")         register_clcmd("say /respawn","fnCmdRespawn")         set_task(2.0,"fnCheckDeadPlayers",_,_,_,"b") }     public fnCmdRespawn(id) {               new CsTeams:cstTeam = cs_get_user_team(id)                   if(!get_cvar_num("amx_respawn"))         {                 client_print(id,print_chat,"[AMXX] Respawning is currently disabled.")                 return PLUGIN_CONTINUE         }                 if(cstTeam == CS_TEAM_T || cstTeam == CS_TEAM_CT)                 set_task(0.5,"fnSpawn",id)         else         {                 client_print(id,print_chat,"[AMXX] You must be on a team to respawn.")                 return PLUGIN_CONTINUE         }                                 if(is_user_alive(id))         { //      new szMessage[33] //      get_pcvar_string(g_pMessage,szMessage,32) //      client_print(id,print_chat,"%s",szMessage)         client_print(id,print_chat,"[AMXX] Your momma would be ashamed of you.")         }         else         { //      new szTrucker[33] //      get_pcvar_string(g_pTrucker,szTrucker,32) //      client_print(id,print_chat,"%s",szTrucker) //      client_print(id,print_chat,"[AMXX] Keep on truckin'.")         }               return PLUGIN_CONTINUE }   public fnCheckDeadPlayers() {         new iPlayers[32],iPlayersnum         get_players(iPlayers,iPlayersnum,"b")                 for(new iCount = 0;iCount < iPlayersnum;iCount++)                 fnSpawn(iPlayers[iCount]) }   public fnEventDeathMsg()                 set_task(0.5,"fnSpawn",read_data(2))   public fnSpawn(id) {         if(is_user_connected(id) && (cs_get_user_team(id) == CS_TEAM_T || cs_get_user_team(id) == CS_TEAM_CT) && get_cvar_num("amx_respawn"))                 cs_user_spawn(id)         new szTrucker[33]         get_pcvar_string(g_pTrucker,szTrucker,32)         client_print(id,print_chat,"%s",szTrucker)           new money = get_pcvar_num(g_pMoney)     cs_set_user_money(id,clamp(cs_get_user_money(id) + money,0,16000))         if(get_cvar_num("amx_respawn_weapon_on"))         {           new szWeapon[33]                 get_pcvar_string(g_pWeapon,szWeapon,32)     format(szWeapon,32,"weapon_%s",szWeapon)       give_item(id,szWeapon)     } }

Basically what it should do is give the player the money defined by money (works) and the gun defined by gun (I dont think this works, didnt work for "glock", name might be wrong but double check code because it looks fine to me.) and the player should be spawned instantly.

A bug I am getting is that the player sometimes leaves behind a leftover, passable player model on respawn, kind of annoying. The /say respawn feature is just there for developement reasons and doesnt even need to be there...

Thx in advance!
Throstur is offline
Send a message via AIM to Throstur Send a message via MSN to Throstur
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 06-12-2006 , 14:54  
Reply With Quote #2

Look here for the correct CS index names. http://www.amxmodx.org/funcwiki.php?go=module&id=4

You could define those globally.

That way either CSW_GLOCK18 or glock works.

The "left behind" player model is a HL bug, you can fix it by spawning the player twice.

For example,
1st spawn, .5 secs
2nd spawn, .7 secs
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 06-12-2006 , 15:07  
Reply With Quote #3

nither "CSW_GLOCK18" or "glock" will work with "give_item"

that link you gave does not even have the correct things to use for item_give in it.

http://forums.alliedmods.net/showthread.php?t=35512

As I already told you on AIM it should be "glock18"
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Throstur
Senior Member
Join Date: Nov 2004
Location: Iceland
Old 06-12-2006 , 17:09  
Reply With Quote #4

As of now I no longer require help. I think.
Throstur is offline
Send a message via AIM to Throstur Send a message via MSN to Throstur
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 08:01.


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