Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2010, 10:32 PM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
Exclamation Everyone with client.var....

I'm trying to make a script that kicks everyone in a level who has a client.chance variable of 2, for example. I'm not sure how to make it so that whoever says /kick 2, everyone with client.chance=2 gets kicked. Right now it only kicks you if yourself. What I mean is, it only kicks you, no one else. How can I make it kick everyone what has client.chance=2?

Here is the script:
PHP Code:
if (created) {
setshape 1,128,128
}
if (
playertouchsme){
  
player.client.chance=2;
}
function 
onPlayerChats(){
  if (
player.chat=="/kick 2"){
  if (
player.client.chance==2){
    
setlevel2 chance.nw,25,45;
  }}

Oh, and I have another script that makes it so that everyone who enters the level gets the client.chance variable, so that isn't the problem.
Reply With Quote
  #2  
Old 10-02-2010, 10:36 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
You have to loop through the current players in the level and check each individual players client.chance value.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #3  
Old 10-02-2010, 10:36 PM
MrDumbledore MrDumbledore is offline
Headmaster of Hogwarts
MrDumbledore's Avatar
Join Date: Oct 2010
Location: The Leaky Cauldron
Posts: 31
MrDumbledore is on a distinguished road
You need to loop through each player.

PHP Code:
function onPlayerChats() { // player chats in the level
  
if (player.guild == "Events Team") {
    if (
player.chat.starts("/kick")) { // chat starts with /kick
      
temp.num player.chat.substring(6).trim(); // find the number the ET said
      
      
for (temp.pl players) { // loop through each player
        
if (pl.client.chance == num) { // it's the number the ET called
          
pl.setLevel2("chance.nw"2545); // warp that player (note "pl."setLevel2)
        
}
      }
    }
  }

You should also consider using clientr variables, or even player. variables serverside (this is preferable for something like this).

Keep in mind you should only use the above script in the level once.
__________________
It is our choices, Harry, that show what we truly are, far more than our abilities.
Reply With Quote
  #4  
Old 10-02-2010, 10:43 PM
ZeroG ZeroG is offline
Developer
Join Date: Oct 2010
Posts: 12
ZeroG is on a distinguished road
Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.