Thread: Hero problem!
View Single Post
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 05-10-2011 , 18:19   Re: Hero problem!
Reply With Quote #26

Quote:
Originally Posted by DarkGod View Post
switch_model(id)
{
if (!
sh_is_active() || !is_user_alive(id) || !gHasBones[id] ) return

if (
get_user_weapon(id) == CSW_GALIL)
if (
get_user_weapon(id) == CSW_DEAGLE)
{
set_pev(id, pev_viewmodel2, gBonesGalil)
set_pev(id, pev_weaponmodel2, gBonesGalil2)
set_pev(id, pev_viewmodel2, gBonesDeagle)
set_pev(id, pev_weaponmodel2, gBonesDeagle2)
}
}

You can't have two weapons up at the same time. Use else if.
Quote:
Originally Posted by DarkGod View Post
That's actually wrong. Right now it does this:

Code:
if(get_user_weapon(index) == CSW_GALIL) { if(get_user_weapon(index) == CSW_DEAGLE) { //Code } }


Anyways, the snippet you provided afterwards is correct.
I can't see an opening brace after the check for the galil weapon, so if user has galil, nothing happens. Or is there an automatically opening brace when you do an if condition? Not really sure about that, since using a return on the next line works. Weird, never though of that.

Quote:
Originally Posted by Fr33m@n View Post
i'm talking about here : Jelly Art Exploited and so on.
I obviously know that switch is used a lot. But here...
MY NAME IS JELLE, NOT JELLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!

Also, I do use switch, but only when there is more than two if conditions.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle