AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with features and better code. [probably fixed] (https://forums.alliedmods.net/showthread.php?t=29778)

Throstur 06-12-2006 13:25

Help with features and better code. [probably fixed]
 
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!

Kensai 06-12-2006 14:54

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

jtp10181 06-12-2006 15:07

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"

Throstur 06-12-2006 17:09

As of now I no longer require help. I think.


All times are GMT -4. The time now is 08:01.

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