IPrintLn("you have perk now ya boy"); player zm_perks::give_perk( PERK_QUICK_REVIVE, false );
break; } }
}
It gives me the perk, but I would like to have an if/else statement so it would display a different message if you already have the perk. I don't know what to put on the "if" part, can someone help me? thanks
IPrintLn("you have perk now ya boy"); player zm_perks::give_perk( PERK_QUICK_REVIVE, false );
break; } }
}
It gives me the perk, but I would like to have an if/else statement so it would display a different message if you already have the perk. I don't know what to put on the "if" part, can someone help me? thanks
You can use an engine function for this I'm pretty sure, just do:
Code Snippet
Plaintext
if (player HasPerk(PERK_QUICK_REVIVE)) { //Do Something }
The names do seem to be exactly the same.
Last Edit: October 24, 2016, 05:32:05 pm by reckfullies
Thank you, it worked perfectly. I have a problem though because I found out that you can get the perk while you are down. How could I change if (player HasPerk(PERK_QUICK_REVIVE)) so it detects if you have the perk OR if you are down?
Code Snippet
Plaintext
function shootable_perk_1(player) { trig_1 = GetEnt("perktrig_quick", "targetname");
if (player HasPerk(PERK_QUICK_REVIVE)) { IPrintLn("no no no you can not have the perko"); wait(3); } else { IPrintLn("your pals go up fast now"); player zm_perks::give_perk( PERK_QUICK_REVIVE, false ); wait(3); }
Thank you, it worked perfectly. I have a problem though because I found out that you can get the perk while you are down. How could I change if (player HasPerk(PERK_QUICK_REVIVE)) so it detects if you have the perk OR if you are down?
Spoiler: click to open...
Code Snippet
Plaintext
function shootable_perk_1(player) { trig_1 = GetEnt("perktrig_quick", "targetname");
if (player HasPerk(PERK_QUICK_REVIVE)) { IPrintLn("no no no you can not have the perko"); wait(3); } else { IPrintLn("your pals go up fast now"); player zm_perks::give_perk( PERK_QUICK_REVIVE, false ); wait(3); }
break; } }
}
This is the script now.
This should work(Haven't tested it though):
Code Snippet
Plaintext
if(IsAlive(player)) { // Do Stuff }
So you would do:
Code Snippet
Plaintext
if (player HasPerk(PERK_QUICK_REVIVE) || !IsAlive(player)) { IPrintLn("no no no you can not have the perko"); wait(3); } else { IPrintLn("your pals go up fast now"); player zm_perks::give_perk( PERK_QUICK_REVIVE, false ); wait(3); }
Last Edit: October 24, 2016, 05:34:02 pm by reckfullies