AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   User weapon (https://forums.alliedmods.net/showthread.php?t=10390)

v3x 02-18-2005 01:05

User weapon
 
Hey, I know how in PHP you do an IF statement like if($weapon == "1") { // do something }. Well, I need to know how to do this in AMXX lol..So if anybody could help me, I'd appreciate it. Thanks.

knekter 02-18-2005 01:12

easy
 
Code:
new clip, ammo new arsenal = get_user_weapon(id, clip, ammo) if(arsenal == CSW_C4) {     blah blah }

v3x 02-18-2005 01:15

Oh, I was going to do it a different way. I was going to use cs_get_weapon_id.

So would these be correct?
CSW_KNIFE
CSW_AWP

knekter 02-18-2005 01:24

yep
 
Code:

/* Id of weapons in CS */
#define CSW_P228                1
#define CSW_SCOUT                3
#define CSW_HEGRENADE                4
#define CSW_XM1014                5
#define CSW_C4                        6
#define CSW_MAC10                7
#define CSW_AUG                        8
#define CSW_SMOKEGRENADE        9
#define CSW_ELITE                10
#define CSW_FIVESEVEN                11
#define CSW_UMP45                12
#define CSW_SG550                13
#define CSW_GALI                14
#define CSW_GALIL                14
#define CSW_FAMAS                15
#define CSW_USP                        16
#define CSW_GLOCK18                17
#define CSW_AWP                        18
#define CSW_MP5NAVY                19
#define CSW_M249                20
#define CSW_M3                        21
#define CSW_M4A1                22
#define CSW_TMP                        23
#define CSW_G3SG1                24
#define CSW_FLASHBANG                25
#define CSW_DEAGLE                26
#define CSW_SG552                27
#define CSW_AK47                28
#define CSW_KNIFE                29
#define CSW_P90                        30


v3x 02-18-2005 01:26

Oh, k..thanks for the list!

Also, one more quick question...If I were to use set_user_maxspeed, what is the default speed of players in CS?

knekter 02-18-2005 01:30

kk
 
320 is defualt, when you use set_user_maxspeed, remember the speed is a float value, example:

Code:
new Float:normal = 320.0 set_user_maxspeed(id, normal)

v3x 02-18-2005 02:09

Alright, I'm having a bit of trouble now..here's my code:
Code:
#include <amxmodx> #include <cstrike> #include <fun> new PLUGIN[]="AWP/C4/Knife speeds" new AUTHOR[]="v3x" new VERSION[]="1.00" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } #define C4SPEED 375.0 #define KNIFESPEED 375.0 #define AWPSPEED 320.0 new clip, ammo new weapon = get_user_weapon(id, clip, ammo) if(weapon == CSW_KNIFE) {     new Float:kspd = KNIFESPEED     set_user_maxspeed(id, kspd)     return PLUGIN_HANDLED } if(weapon == CSW_C4) {     new Float:c4spd = C4SPEED     set_user_maxspeed(id, c4spd)     return PLUGIN_HANDLED } if(weapon == CSW_AWP) {     new Float:awpspd = AWPSPEED     set_user_maxspeed(id, awpspd)     return PLUGIN_HANDLED }
Keep in mind that this is my first attempt at making a plugin, lol.

philman213 02-18-2005 02:14

What errors are you getting?

v3x 02-18-2005 02:15

No errors at all when I compile. It's just when I'm in the game it doesn't seem to set the speed higher. Maybe I just have the speeds wrong?

knekter 02-18-2005 10:31

hmmm
 
lol 375 isn't high at all.... you wouldn't even notice a diff. Try 450-500 and also I would add this:

Code:
register_event("CurWeapon", "check_speed", "be") public check_speed(id) {     new clip, ammo     new weapon = get_user_weapon(id, clip, ammo)     if(weapon == CSW_KNIFE) {         new Float:kspd = KNIFESPEED         set_user_maxspeed(id, kspd)         return PLUGIN_HANDLED     }     if(weapon == CSW_C4) {         new Float:c4spd = C4SPEED         set_user_maxspeed(id, c4spd)         return PLUGIN_HANDLED     }     if(weapon == CSW_AWP) {         new Float:awpspd = AWPSPEED         set_user_maxspeed(id, awpspd)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED }

now if they change their weapon their speed will not stop.


All times are GMT -4. The time now is 13:59.

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