order of conditions in if()
<{
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.
if(!is_user_alive(id) && (is_user_admin(id) || g_iBestClimber != id) && g_fStartTime[id])
still nothing
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
and what`s the connection between "&&" and admin flag acces ?
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
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 ...
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])
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 ..
if(is_user_alive(id) && (is_user_admin(id) || g_iBestClimber == id) && g_fStartTime[id])
why the fuck there was !is_user_alive
because after those negations was "return 1;", and g_fStartTime[id] must be false in order to continue plugin
http://ampaste.net/d70cc6819
yes xpaw, i tested that, and it`s giving noclip to everybody, not only admins.
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 =)
no, i made a command to activate and deactivate it xD here only it gives acces to activate/deactivate
if(!is_user_alive(id) || !is_user_admin(id) || g_iBestClimber != id || g_fStartTime[id])
thanks it worked
Originally posted by doktorif(!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])
thx a lot numb xD
Please log in to post replies.