Max player
Hello,
today I found a code but I did not understand well a part of the script , Code:
this is what i didn't understand Code:
why its %0 can i replace it with 1 and what is <= and get_maxplayers is it take the max player from server or what ! I'm still learning ... |
Re: Max player
What you see is called a macro. %0, %1, up to %9. are just arguments you pass.
A macro is replaced at compilation time. For example, if you have IsPlayer(iAttacker) in your code, it will be replaced at compilation with 1 <= iAttacker <= g_iMaxPlayers %0 is just a way to say that macro takes one argument. |
Re: Max player
Yes i understand the replace of the 'Macro' , i've already read a 'tuto'
the actually define what is it , why we need a maxplayers in this define ! ? |
Re: Max player
To check whether index is actually a player. If index is between 1 and maxclients (maxclients being the current server max slots), then it's a player. If your server has 16 slots, a player's index can't be 17.
It's just a fast way to filter between players and others entities. You can take damage from something other than a player. The code will work only if attacker is a player. |
Re: Max player
Really thanks dude ^^'
|
Re: Max player
1 return if is a less than or equal a attacker and the attacker return if is a less than or equal a maxplayers
and for an example : switch (a) { case 0 .. 50: { //This code will run if 0 <= a <= 50 // which is From 0 to 49 } so ('THIS IS WRONG ITS JUST A EXAMPLE') switch (attacker){ case 1..maxplayers //1 <= attacker <= maxplayers // from 1 to maxplayers if maxplayers = 16 then from 1 to 15 } maybe this is a easy way to unders... |
| All times are GMT -4. The time now is 15:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.