Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Chance Event Trouble (https://forums.graalonline.com/forums/showthread.php?t=134265694)

clarke119 02-04-2012 04:42 PM

Chance Event Trouble
 
Hey guys, Having trouble making my chance event.

On the different boxes ie. 1, 2 , 3, 4, 5, 6, 7, 8 I have this code:

NPC Code:
function onCreated()
{
this.setShape(1, 240, 205);
}
function onPlayerTouchsMe()
{
clientr.box=1;
}



And I'm using this for kick:

NPC Code:
function onPlayerChats()
{
if (player.guild == "Events Team" || player.guild == "Events Admin" || player.queryRight("events")) {
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("lost-osl1.nw",30.5,10.8); // warp that player (note "pl."setLevel2)
}
}
}
}
}



Having lots of trouble, such as on kick it texts everyone on level to kick location etc..

Thanks in advance,

fowlplay4 02-04-2012 06:09 PM

You're setting clientr.box in the chance box but checking client.chance in the script.

clarke119 02-05-2012 11:58 PM

Quote:

Originally Posted by fowlplay4 (Post 1683628)
You're setting clientr.box in the chance box but checking client.chance in the script.

I've fixed that thanks (silly error), but now the trouble is no matter what box im kicking the person not on event tag is get kicked no matter what box he's in:

For example "/kick1" and he's in 2 hes still getting kicked, I think its because of its kicking who evers not on ettag?

fowlplay4 02-06-2012 12:12 AM

Make sure the player isn't an ET before warping him away.

if (pl.guild != "Events Team") {

You should also add a number check if (num > 0) as well because:

Judging by your (I'm under the impression you didn't write it) script: /kick2 is 0 /kick 2 is 2.

Also please use PHP tags instead of CODE.

clarke119 02-06-2012 12:25 AM

Quote:

Originally Posted by fowlplay4 (Post 1683737)
Make sure the player isn't an ET before warping him away.

if (pl.guild != "Events Team") {

You should also add a number check if (num > 0) as well because:

Judging by your (I'm under the impression you didn't write it) script: /kick2 is 0 /kick 2 is 2.

Also please use PHP tags instead of CODE.

So could you write out your version please? and I put /kick2 because of the substring

scriptless 02-06-2012 12:35 AM

I don't see why the box the player is on, should be stored in a player flag.. :( Can't that value just exist in a level npc or something?

PHP Code:

if (pl.client.chance == num) { 

Should be

PHP Code:

if (pl.clientr.chance == num) { 

Plus FP4's post, should solve your problem. But make sure it doesn't kick EM's either..

clarke119 02-06-2012 12:46 AM

I fixed it by end the et tag at kick, seems to work. but thanks guys!


All times are GMT +2. The time now is 10:22 AM.

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