Raised This Month: $ Target: $400
 0% 

Help with features and better code. [probably fixed]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


Thread Tools
Display Modes

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