order of conditions in if()

Started by .nnnnn1
22/12/2008 16:49
Page 1 of 2
.nnnnn122/12/2008 16:49(edited 02/01/2009 22:17)

<{
if(!is_user_alive(id) || g_iBestClimber != id || g_fStartTime[id])
{
return 1;
}
if(!get_user_noclip(id))
{
set_user_noclip(id,1)
set_hudmessage(0, 255, 0, 0.6, 0.01, 2, 7.0, 8.0, 0.1, 1.0, -1);
show_hudmessage(id, "Noclip Activated.");
}
else
{
set_user_noclip(id,0)
set_hudmessage(0, 255, 0, 0.6, 0.01, 2, 7.0, 8.0, 0.1, 1.0, -1);
show_hudmessage(id, "Noclip Disabled.");
}
return PLUGIN_HANDLED
} >>

hi. i hope that someone can help me with this line:

if(!is_user_alive(id) || g_iBestClimber != id || g_fStartTime[id])

first, it`s verified if the user is alive, than if he is the 1337 climber (bestclimber) than if that player have the timer running. if he pass all conditions, he will recieve noclip reward. i want to use noclip if i am only admin, not necessarly bestclimber. i know that something should be added to that line, something like "&& is_user_admin(id)", i`ve tried, but nothing happened, except all players were allowed to use that reward.

xPaw mapper22/12/2008 17:57

if(!is_user_alive(id) && (is_user_admin(id) || g_iBestClimber != id) && g_fStartTime[id])

.nnnnn122/12/2008 18:10

still nothing

nPoc7o o7k@4eH22/12/2008 19:19(edited 23/12/2008 14:06)

public clcmd_noclip(id)
{
if(is_user_alive(id) && g_iBestClimber[id] && g_fStartTime[id])
{
return 1;
}
if(!get_user_noclip(id))
{
set_user_noclip(id,1)
set_hudmessage(0, 255, 0, 0.6, 0.01, 2, 7.0, 8.0, 0.1, 1.0, -1);
show_hudmessage(id, "Noclip Activated.");
}
else
{
set_user_noclip(id,0)
set_hudmessage(0, 255, 0, 0.6, 0.01, 2, 7.0, 8.0, 0.1, 1.0, -1);
show_hudmessage(id, "Noclip Disabled.");
}
return PLUGIN_HANDLED
}

//mod edit:
pls do not use code tags -schlumpf

.nnnnn122/12/2008 19:31

and what`s the connection between "&&" and admin flag acces ?

xPaw mapper23/12/2008 13:21(edited 23/12/2008 14:06)

public clcmd_noclip( id ) {
if(!is_user_alive(id) && (is_user_admin(id) || g_iBestClimber != id) && g_fStartTime[id])
return PLUGIN_HANDLED;

set_hudmessage(0, 255, 0, 0.6, 0.01, 2, 7.0, 8.0, 0.1, 1.0, -1);

if(!get_user_noclip(id)) {
set_user_noclip(id, 1);
show_hudmessage(id, "Noclip Activated.");
} else {
set_user_noclip(id, 0);
show_hudmessage(id, "Noclip Disabled.");
}
return PLUGIN_HANDLED;
}


//mod edit:
pls do not use code tags -schlumpf

.nnnnn123/12/2008 15:46(edited 23/12/2008 15:55)

i don`t know what to do, it really doesn`t want to work with everything that i`m trying to do. xpaw, still nothing ... 8-| it gives noclip to everyone, not only for admins ...

xPaw mapper23/12/2008 15:59

change
if(!is_user_alive(id) && (is_user_admin(id) || g_iBestClimber != id) && g_fStartTime[id])

to

if(!is_user_alive(id) && (is_user_admin(id) || g_iBestClimber == id) && g_fStartTime[id])

.nnnnn123/12/2008 16:12

not working ... i`ve tried it with if(!is_user_alive(id) && ((get_user_flags(id) & ADMIN_LEVEL_B) || g_iBestClimber != id) && g_fStartTime[id]) too and it doesn`t works ... i don`t think is possible to work ..

xPaw mapper23/12/2008 17:34(edited 23/12/2008 17:35)

if(is_user_alive(id) && (is_user_admin(id) || g_iBestClimber == id) && g_fStartTime[id])

why the fuck there was !is_user_alive

.nnnnn123/12/2008 18:40(edited 23/12/2008 18:41)

because after those negations was "return 1;", and g_fStartTime[id] must be false in order to continue plugin

xPaw mapper23/12/2008 18:58(edited 23/12/2008 18:59)

http://ampaste.net/d70cc6819

.nnnnn123/12/2008 23:20

yes xpaw, i tested that, and it`s giving noclip to everybody, not only admins.

FLR24/12/2008 14:54

Test this: Link

PrEn1uMz24/12/2008 17:33

but there is a problem with this cmd

if( (is_user_alive(id) && g_fStartTime[id]) && (is_user_admin(id) || g_iBestClimber == id) )

if player is BestClimber = ok = noclip on

someone beat his time and he wants to turn off noclip, he can't =)

.nnnnn124/12/2008 19:36

no, i made a command to activate and deactivate it xD here only it gives acces to activate/deactivate

doktor01/01/2009 18:16

if(!is_user_alive(id) || !is_user_admin(id) || g_iBestClimber != id || g_fStartTime[id])

.nnnnn101/01/2009 19:24

thanks it worked

NumB01/01/2009 21:24

Originally posted by doktor
if(!is_user_alive(id) || !is_user_admin(id) || g_iBestClimber != id || g_fStartTime[id])


So he must be and admin and best climber...

Use this:

if(!is_user_alive(id) || !(is_user_admin(id) || g_iBestClimber == id) || g_fStartTime[id])

.nnnnn102/01/2009 11:05

thx a lot numb xD

Page 1 of 2

Please log in to post replies.