Raised This Month: $ Target: $400
 0% 

Weapon Constants


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-27-2005 , 09:23   Weapon Constants
Reply With Quote #1

Would it be possible for someone to post the weapon constants for Sven Coop? I cant seem to find them anywhere.
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-27-2005 , 15:20  
Reply With Quote #2

You can make them yourself, here's what I did to get some shit for TT.

The stuff on the bottom I'm just including as an example. The first set of stuff is probably what you want to use and compile.

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Get Weap","1.0","Hawk552");         register_clcmd("weap","get_weap"); } public get_weap(id) {     new clip,ammo,weap = get_user_weapon(id,clip,ammo);         client_print(id,print_chat,"Weap ID: %i, Clip: %i, Ammo: %i",weap,clip,ammo);     client_print(id,print_console,"Weap ID: %i, Clip: %i, Ammo: %i",weap,clip,ammo);         return 0; }

Code:
#include <amxmodx> #include <amxmisc> //#include <fun> //#include <engine> #include <tt> public plugin_init() {     register_plugin("TT Test","1.0","Hawk552");         register_concmd("amx_tt_weap","get_weap");         register_concmd("amx_tt_give_weap","give_weap",ADMIN_KICK," <num> - gives weap");         register_concmd("amx_tt_get_stamina","check_vusers");         register_concmd("amx_tt_set_stamina","set_vusers");         register_concmd("amx_tt_spawn","spawn_dude",ADMIN_KICK, "<target> - spawns target"); } public spawn_dude(id,level,cid) {     if(!cmd_access(id,level,cid,2))         return 0;             new arg[32];     read_argv(1,arg,31);         new target = cmd_target(id,arg,0);         set_task(0.5,"spawn_dude2",target);     set_task(0.7,"spawn_dude2",target);         return 0; } public spawn_dude2(id) {     spawn(id); } public get_weap(id) {     new weapon[32];         tt_get_user_weapon(id,weapon,31);         new clip, ammo, weap = get_user_weapon(id,clip,ammo);         client_print(id,print_chat,"%s, %i, %i, %i",weapon,weap,clip,ammo); } public give_weap(id,level,cid) {     if(!cmd_access(id,level,cid,2))         return 0;             new arg[32];     read_argv(1,arg,31);         tt_give_user_weapon(id,str_to_num(arg),1);         return 0; } public set_vusers(id) {     new arg[32];     read_argv(1,arg,31);         if(arg[0] == '0')     {         tt_set_user_stamina(id,TT_STAMINA_NONE);     }     else if(arg[0] == '1')     {         tt_set_user_stamina(id,TT_STAMINA_FULL);     }         return 0; } public check_vusers(id) {     new Float:stamina = tt_get_user_stamina(id);         client_print(id,print_chat,"%d",stamina);         return 0; }

Code:
/* Hawk's notes: This is a stock file, not finished yet or even close to done */ #include <fun> #include <engine> #if defined _tt_included   #endinput #endif #define _tt_included #define TT_SPECTATOR 0 #define TT_BRITISH 1 #define TT_GERMAN 2 #define TT_MAUSER_BAYONET 1 #define TT_ENFIELD_BAYONET 2 #define TT_BRITISH_BOMBER_BAT 3 #define TT_GERMAN_BOMBER_BAT 4 #define TT_MAUSER 7 #define TT_ENFIELD 8 #define TT_GERMAN_GRENADE 9 #define TT_BRITISH_GRENADE 10 #define TT_BRITISH_BOMBER_GRENADE 11 #define TT_GERMAN_BOMBER_GRENADE 12 #define TT_STAMINA_FULL 112617062.0 #define TT_STAMINA_NONE 0.0 stock tt_get_user_weapon(id,str[],len) {       new clip, ammo, weap = get_user_weapon(id,clip,ammo);         switch(weap)     {         case 0:         {             return 0;         }                 case 1:         {             format(str,len,"Mauser Bayonet");         }                 case 2:         {             format(str,len,"Enfield Bayonet");         }                 case 3:         {             format(str,len,"British Bomber Bat");         }                 case 4:         {             format(str,len,"German Bomber Bat");         }                 case 5:         {             // Doesn't exist yet         }                 case 6:         {             // Doesn't exist yet         }                 case 7:         {             format(str,len,"Mauser");         }                 case 8:         {             format(str,len,"Enfield");         }                 case 9:         {             format(str,len,"German Grenade");         }                 case 10:         {             format(str,len,"British Grenade");         }                 case 11:         {             format(str,len,"British Bomber Grenade");         }                 case 12:         {             format(str,len,"German Bomber Grenade");         }     }         return 0; } stock tt_give_user_weapon(id,weap,strip) {     switch(weap)     {         case 1:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_GMauserG98Melee");         }             case 2:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_CEnfieldMelee");         }             case 3:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_BritGrenMelee");         }                 case 4:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_GermGrenMelee");         }             case 5:         {             // Doesn't exist yet         }             case 6:         {             // Doesn't exist yet         }                 case 7:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_GMauserG98");         }                 case 8:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_CEnfield");         }                 case 9:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_GMauserG98Nade");         }                 case 10:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_CEnfieldNade");         }                 case 11:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_BritGrenNade");         }                 case 12:         {             if(strip == 1)             {                 strip_user_weapons(id);             }                         give_item(id,"weapon_GermGrenNade");         }     }         return 0; } stock Float:tt_get_user_stamina(id) {     new Float:vec[3];     entity_get_vector(id,EV_VEC_vuser1,vec);         return vec[0]; } stock tt_set_user_stamina(id,Float:stamina) {     new Float:vec[3];     vec[0] = stamina;     entity_set_vector(id,EV_VEC_vuser1,vec);         return 1; }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-27-2005 , 19:53  
Reply With Quote #3

The reason I ask is because I am trying to use the model replacement plugin. It comes to this line:

Code:
if(weap == CSW_DEAGLE){//<--- Replace with a different weapon constant to replace another weapon

Ive tried getting the id before and it gives me a single digit number, but thats not good enough to satisfy the above line.
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-27-2005 , 20:14  
Reply With Quote #4

Once again, just make your own. My guess is the crowbar is 1, so try typing "weap" (install the plugin) while in game and using a crowbar, and see what number it gives you. From there, just write your own constants, so it would be something like:

#define SVEN_CROWBAR 1

Assuming that 1 is the crowbar.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-27-2005 , 20:35  
Reply With Quote #5

Code:
\amxmodx\scripting\models.sma(20) : error 035: argument type mismatch (argument 2)
\amxmodx\scripting\models.sma(21) : error 035: argument type mismatch (argument 2)
\amxmodx\scripting\models.sma(33) : error 035: argument type mismatch (argument 2)
\amxmodx\scripting\models.sma(34) : error 035: argument type mismatch (argument 2)
Would you know why Im getting these?
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-27-2005 , 20:49  
Reply With Quote #6

Try this:

Code:
 #include <amxmodx>  #include <amxmisc>  #include <engine>    #define SVEN_RPG 8    public plugin_init(){     register_plugin("Gun Replacement","1.0","Lord Saddler/Angel killer")     register_clcmd("say !rpg_1","rpg_on",0,"Switch to custom rpg model")     register_clcmd("say !rpg_0","rpg_off",0,"Switch to normal rpg model") }  public rpg_on(id){     if(!is_user_alive(id)){         return PLUGIN_HANDLED     }     new clip, ammo     new weap = get_user_weapon(id,clip,ammo)     if(weap == 8){  //<--- Replace with a different weapon constant to replace another weapon         entity_set_string(id, EV_SZ_viewmodel, "models/gargr/p_snarkrpg.mdl")//<--- Change the model name for different weapons           entity_set_string(id, EV_SZ_weaponmodel, "models/gargr/v_snarkrpg.mdl")//<--- Change the model name for different weapons       }     return PLUGIN_CONTINUE }  public rpg_off(id){     if(!is_user_alive(id)){         return PLUGIN_HANDLED     }     new clip, ammo     new weap = get_user_weapon(id,clip,ammo)     if(weap == 8){         entity_set_string(id, EV_SZ_viewmodel, "models/gargr/p_rpg.mdl")         entity_set_string(id, EV_SZ_weaponmodel, "models/gargr/v_rpg.mdl")     }     return PLUGIN_CONTINUE }  public plugin_precache(){     precache_model("models/gargr/p_snarkrpg.mdl")     precache_model("models/gargr/v_snarkrpg.mdl")     precache_model("models/gargr/p_rpg.mdl")     precache_model("models/gargr/v_rpg.mdl") }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-27-2005 , 21:03  
Reply With Quote #7

Compiled with no problems, but when I say !rpg_1, the model disappears.

I look up the function entity_set_string, and it says in the notes:

Do not use this to set models, use entity_set_model.

Thanks anyway
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-27-2005 , 21:12  
Reply With Quote #8

It's probably because you have the v and p stuff messed up.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-27-2005 , 21:14  
Reply With Quote #9

Quote:
Originally Posted by Hawk552
It's probably because you have the v and p stuff messed up.
*Bangs head on table in shame*

Thanks a lot. +karma for you.
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-27-2005 , 21:20  
Reply With Quote #10

also, I think I might have developed a misconception here. You do not need to use constants, it's just easier to keep track of.

When you look at this:

Code:
if(weap == 8)

It can be either that, or

Code:
if(weap == SVEN_RPG)

It's just much easier to keep track of and use in later plugins if you use constants.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 15:58.


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