AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server crashes when comparing weapons... (https://forums.alliedmods.net/showthread.php?t=12885)

BioHazardousWaste 04-27-2005 22:15

Server crashes when comparing weapons...
 
Hey all, i'm just trying to compare weapons. I need to know if a user is holding a nade or a knife, because set_user_hitzones doesn't work for that. So I don't want it to say you dodged, when in fact you didn't. Maybe i'm not doing it right, but here's my code

if(is_user_alive(Victim) && (get_user_weapon(id) != CSW_KNIFE) || (get_user_weapon(id) != CSW_HEGRENADE){
//do dodge stuff
}

and it crashes.

If I use this, it works fine:
if(is_user_alive(Victim))
{
//do dodge stuff
}

teame06 04-27-2005 22:21

Re: Server crashes when comparing weapons...
 
Code:
if(is_user_alive(Victim) {     if((get_user_weapon(id) != CSW_KNIFE) || (get_user_weapon(id) != CSW_HEGRENADE))     {     //do dodge stuff     } }
have you tried it like this? I see that you are trying to put a and and or if statement together, not sure if that the problem.

Ced 04-27-2005 22:33

try
Code:
if ( is_user_alive( victim ) ) {    new iWeaponId, iClip, iAmmo;    iWeaponId = get_user_weapon( id, iClip, iAmmo );    if ( iWeaponId != CSW_KNIFE || iWeaponId != CSW_HEGRENADE ) {       //whatever    } }


All times are GMT -4. The time now is 16:35.

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