Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-25-2011, 06:28 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Exclamation Event Kick System Proplem

Hello Guys, I am it Nogross, and I have a little proplem.. I want to make a kick system which works in the specified Event level.. It don't work so please help me, it should work so:

ET says /kick - then he as to click a player and the player cordinates will be changed.
PHP Code:
//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "/kick") {
    for (
temp.plplayers) {
      if (
mousex in temp.pl.xtemp.pl.| && mousey in temp.pl.ytemp.pl.| ) {
        
triggerserver("gui"name"KickPlayer"temp.pl);
      }
    }
  }

  function 
KickPlayer() {
    
player.30;
    
player.30;
  } 
I can't find the solution.. If it's very obviously or just nooby I am srry.

Thanks anyway!
NG
Reply With Quote
  #2  
Old 09-25-2011, 06:34 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
PHP Code:
// Where is the triggerserver?
//#CLIENTSIDE 

function onPlayerChats() {
  if (
player.chat == "/kick") {
    for (
temp.plplayers) {
      if (
mousex in temp.pl.xtemp.pl.| && mousey in temp.pl.ytemp.pl.| ) {
        
triggerserver("gui"name"KickPlayer"temp.pl);
      }
    }
  }
// Missed a brace.

function KickPlayer() {
  
player.30;
  
player.30;

The corrections I could make are in the script.
__________________
Reply With Quote
  #3  
Old 09-25-2011, 06:37 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Question

Quote:
Originally Posted by Emera View Post
PHP Code:
// Where is the triggerserver? 
The corrections I could make are in the script.
Thank you but how you mean that, // Where is the triggerserver?
It's the first time I do something with mouse so could you explain me that please ^.^ ?
Reply With Quote
  #4  
Old 09-25-2011, 06:42 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Are you posting the full code?

You have a triggerserver in your code.
PHP Code:
triggerserver("gui"name"KickPlayer"temp.pl); 
Now, either you haven't posted that bit, or that just appeared from nowhere. Also, wouldn't it be easier to use a triggeraction instead? That's what I would do.
__________________
Reply With Quote
  #5  
Old 09-25-2011, 07:19 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
It's the full code yes.. since I'm a really really new coder, I don't really know how to use it, I mean triggerserver. But could you explain me the triggeraction and how to use it? That would be great.
Reply With Quote
  #6  
Old 09-25-2011, 07:24 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I imagine this is what you're going for, I've re-factored your code below. You could create a class called:

events_commands

PHP Code:
function onCreated() {
  
// Gives your NPC shape on the server-side so 
  // triggeraction has something to hit.
  
this.setshape(13232);
}

function 
onActionKickPlayer() {
  
// Make sure the 'kicker' is on the Events Team
  
if (player.guild == "Events Team") {
    
// Get account from first parameter
    
temp.acc params[0];
    
// Kick account
    
kickPlayer(temp.acc); 
  }
}

function 
kickPlayer(acc) {
  
// Find Player
  
with (findplayer(acc)) {
    
// Kick/Relocate Player
    
player.30
    
player.30;
  }
}

//#CLIENTSIDE

function onPlayerChats() { 
  if (
player.chat == "/kick") { 
    for (
temp.plplayers) { 
      if (
mousex in temp.pl.xtemp.pl.| && mousey in temp.pl.ytemp.pl.| ) {
        
// To trigger level npcs you have to use triggeraction like this:
        // It will trigger onActionKickPlayer
        
triggeraction(this.1this.1"KickPlayer"temp.pl.account);
      } 
    } 
  } 

and place that in your event levels like this:

PHP Code:
function onCreated() {
  
join("event_commands");

__________________
Quote:
Reply With Quote
  #7  
Old 09-26-2011, 12:16 AM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Thank you fowl, I learned much in youre code. Ty again. I understand all except the part with actionkickplayer wouldnt it be easier to add just a if (...) at func playerchats?
Reply With Quote
  #8  
Old 09-26-2011, 12:22 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
The kickplayer function you are wondering about is quite easy. It is a player made function primarily for that NPC. Example...
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
testing(); //Call the function
  // The players chat will change to Tested!
}

function 
Testing() { //Create the function
  
player.chat "Tested";

You can create you own functions for all sorts of purposes. Here you can see I have created the function Testing(). When the function is called, the players chat will change to Tested.

You can now use that function throughout your script.
__________________
Reply With Quote
  #9  
Old 09-26-2011, 12:34 AM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
xD i know i meant something else... I dont understand why its not easier to add just a if (...) at the playerchat func
Reply With Quote
  #10  
Old 09-26-2011, 01:27 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Nogross View Post
Thank you fowl, I learned much in youre code. Ty again. I understand all except the part with actionkickplayer wouldnt it be easier to add just a if (...) at func playerchats?
I guess you're referring to the Events Team guild check.

It should be on both (server and client) sides.

PHP Code:
// .. other code ..
function onActionKickPlayer() { 
  
// Make sure the 'kicker' is on the Events Team 
  
if (player.guild == "Events Team") {
    
// May help you understand what's happening better.
    
echo(player.account SPC "kicking" SPC params[0]);
    
// Kick
  
}
}

//#CLIENTSIDE

function onPlayerChats() {
  if (
player.guild == "Events Team") {
    if (
player.chat == "/kick") {
      
// .. other code ..
    
}
  }

__________________
Quote:
Reply With Quote
  #11  
Old 09-26-2011, 04:56 PM
Nogross Nogross is offline
Registered User
Nogross's Avatar
Join Date: Feb 2011
Location: Germany
Posts: 23
Nogross is an unknown quantity at this point
Send a message via ICQ to Nogross
Quote:
Originally Posted by fowlplay4 View Post
I guess you're referring to the Events Team guild check.

It should be on both (server and client) sides.

PHP Code:
// .. other code ..
function onActionKickPlayer() { 
  
// Make sure the 'kicker' is on the Events Team 
  
if (player.guild == "Events Team") {
    
// May help you understand what's happening better.
    
echo(player.account SPC "kicking" SPC params[0]);
    
// Kick
  
}
}

//#CLIENTSIDE

function onPlayerChats() {
  if (
player.guild == "Events Team") {
    if (
player.chat == "/kick") {
      
// .. other code ..
    
}
  }

Okay thanks I understand now all. Ty for youre help guys !
Reply With Quote
  #12  
Old 09-26-2011, 06:57 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Just to point out something obvious, you really should create an array of the players in mouse range first and do a single trigger with that array instead of a trigger for each player
Reply With Quote
Reply


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 01:26 PM.


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