![]() |
Onwater and Keypressed problems
PHP Code:
|
setlevel(2) is serverside.
Also, you may want to detect at player.x+1.5 and playery+2, which is the 'center' of the player. |
I would of done the key check before the water check (:
If this is for an event or something, it would of been easier to alter the player's x/y. |
Quote:
|
PHP Code:
|
keypressed/keydown are clientside.
And keydown(5) is 'S' :) 6 is 'A'. |
keydown( key ) the specified key is pressed (0..10: up,left,down,right,S,A,D,M,tab,Q,P)
doesnt work that way anymore? and forgot about that clientside, :) |
5 has always been sword and 6 has always been grab :) If it has ever stated otherwise it was wrong. Easier way to find out what is the right button is to open your control options and the buttons are listed from top to bottom in their numerical order, starting at 0. I actually didn't know about this until someone else posted, but it has come in handy a lot for those keys that I don't use often(like Q/P and such).
|
PHP Code:
|
Quote:
|
This is pretty unrelated, but I have a question about onKeyPressed(). I've seen plenty of people using that action in conjunction with keydown(). Isn't this redundant, since onKeyPressed() has parameters that provide which key is pressed? Why not use a simple check with the parameters, rather than a function?
|
Quote:
It may be possible to access the settings data via. some obscure way, but I'm not sure about that. |
PHP Code:
|
Quote:
I just noticed another error was that you didn't put testtourny.nw in quotes, which you need to do for all strings, otherwise it'll try to read it as a variable. |
Quote:
|
Put quotes, still nothing.
|
Quote:
|
Because triggeractions do not simply call functions, but calls a function specified for triggeractions:
function onactionWhatTriggerWasCalled() {} would be called with: triggeractionaction(x,y,"WhatTriggerWasCalled",x,y ,z); I think. |
your right, cant believe i forgot that, its onActionActionHey. now its:
PHP Code:
|
You also need to setshape(1,32,32) // or whatever the size you want on the serverside(onCreated() is where it should be called) for the server to be able to recognize the NPC.
Ideally, what you can also do is set up a system weapon to have triggers for warping the player, and simply do something like this on the clientside: triggerServer("gui","-System","WarpPlayer",player.account,dest); // you don't have to use temp.var after you declared the variable a temp. |
PHP Code:
|
Debug that motha'!
Start putting player.chat = "test" or something in various places to find out where the script is losing its purpose. Also, it should just be: function onKeyPressed() { if (keydown(6)) { } } Otherwise you're basically defining(or trying to) 6 as a variable for the first parameter of the keypressed function, which may be screwing things up. Also, temp.warp is not a very descriptive variable name as it's actually referring to a player, so should be something more reflective... at least something like temp.p or such. |
On a side note, there's probably a better way to accomplish what you're trying to do, which appears to be some sort of warp the player somewhere if they are in water, the script could easily be replaced by using level warps.
Also your script is incredibly insecure. You don't need to send any extra parameters at all. PHP Code:
triggeraction(this.x + 0.5, this.y + 0.5, "WarpPlayerw", ""); |
My hero. Thank u everyone. I feel dumb, always forget stupid things like putting a 6 in that function
|
I thought I explained triggerAction() to you in multiple posts in the last thread that you asked about it? You should really look back on those posts in the future.
Also, some of you are really bad at helping people with scripting problems, haha. I can't believe it took so long for someone to mention the onActionActionname() bit that he was missing when reading the function called by the triggerAction(). :p |
Quote:
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 09:14 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.