Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial Basic usage of level.players
#1
level.players is a global var with all the players that are currently on the server.
You have a lot of uses for level.players like counting players that have the 'a' in their name. Or threading on everyone. And a lot more.

Here are some examples
Code:
//script that kills everyone. for(i=0;i<level.players.size;i++) { player = level.players[i]; player suicide(); } //Kills all the players with 1337 in their name for(i=0;i<level.players.size;i++) { player = level.players[i]; if(IsSubStr(player.name, "1337" )) player suicide(); } //Kills everyone who has the isNoob var set to true for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.isNoob == true) player suicide(); } //Counts all players that have more then 10 kills for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["kills"] > 10) level.PlayersWithTenKills ++; }

I hope you guys can use this for something. Post your questions below.
[Image: MaEIQ.png]
Reply

#2
Thanks this is really usefull Smile
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#3
could you please show how to call thread with count kill's?

like would this work
Code:
for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["kills"] > 10) level.PlayersWithTenKills ++; self iPrintlnBold( "^1welldone 10kills" ); }
Reply

#4
(04-03-2011, 13:50)rotceh_dnih Wrote: could you please show how to call thread with count kill's?

like would this work
Code:
for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["kills"] > 10) level.PlayersWithTenKills ++; self iPrintlnBold( "^1welldone 10kills" ); }

Code:
for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["kills"] > 10) level.PlayersWithTenKills ++; player iPrintlnBold( "^1welldone 10kills" ); }
This is the right one, self is always an entity but in this case its the player.. so you have to use Player instead of Self
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#5
thanks heaps but what about a thread would that be
Code:
player thread dostuff();
Reply

#6
Code:
CountKills() { for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["kills"] > 10) { level.PlayersWithTenKills ++; player iPrintlnBold( "^1welldone 10kills" ); } } }

Would be the function. And you don't want to thread it on a person, so you should use:
Code:
thread CountKills();
NOT
Code:
self thread CountKills();
[Image: MaEIQ.png]
Reply

#7
arr ok thanks that works but the message repeats itself all the time and dose not reset on death
if know what i mean
Reply

#8
(04-03-2011, 14:23)rotceh_dnih Wrote: arr ok thanks that works but the message repeats itself all the time and dose not reset on death
if know what i mean
thats coz its a for loop ... and if you die you dont have less kills so
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#9
any ideas how i can do it then? Angel
Reply

#10
Code:
CountKills() { for(i=0;i<level.players.size;i++) { player = level.players[i]; if(player.pers["headshots"] > 100) { level.aimbotplayers ++; player iPrintlnBold( "^1AIM BOT DETECTED" ); } } }
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Our Level Fastfile is Different from the Server. CheeseToast 6 15,485 11-03-2013, 17:52
Last Post: CheeseToast
  Basic Mod CheeseToast 10 10,260 11-02-2013, 18:02
Last Post: Yamato
  Help choose 2 random players?(1 each team) 26hz 6 6,277 09-12-2013, 17:32
Last Post: Yamato
  99% CPU Usage mn_acer1 6 4,514 02-05-2013, 00:39
Last Post: JariZ
  Players alive on hud spiderabd11 5 5,355 01-06-2013, 18:50
Last Post: DidUknowiPwn
  [TUTORIAL] Basic Syntax KrypTiK 0 2,947 12-29-2012, 20:33
Last Post: KrypTiK
  Add protected players to Maxping warn raminr63 6 5,071 10-04-2012, 18:02
Last Post: raminr63
  All Level and Perks Pro Unlocker browneggs 1 3,801 09-24-2012, 09:38
Last Post: d0h!
Tongue Weapon Remover For Players downy 3 4,434 09-11-2012, 20:32
Last Post: JariZ
  [Tutorial] Level, Prestige and Token hack, Configurable C# Source d0h! 3 8,491 08-31-2012, 11:26
Last Post: Puffiamo

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.