Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Scripting Question? (https://forums.graalonline.com/forums/showthread.php?t=87071)

[email protected] 07-25-2009 11:58 PM

Scripting Question?
 
Hi, I am making a shovel script and im using the weaponfired because when you press d, it digs. Well, the players are just holding d and are getting money. How do I make it to where you have to press it over and over in order to get money, rather than holding d?

Thanks.

fowlplay4 07-26-2009 12:38 AM

Well you need to use a Boolean flag to prevent the execution of job related script. Here's an example where I use a boolean flag and a loop to unset the flag when the key isn't pressed.

PHP Code:

//#CLIENTSIDE
function onKeyPressed() {
  if (
keydown(4) && !this.keydown) {
    
this.keydown true;
    
doJobStuff();
    
setTimer(0.05);
  }
}

function 
onTimeout() {
  
this.keydown keydown(4);
  if (
this.keydownsetTimer(0.05);
}

function 
doJobStuff() {
  
player.chat "shoveling dawg";



[email protected] 07-26-2009 12:42 AM

hmm but it still is letting you hold it.

[email protected] 07-26-2009 12:59 AM

Nevermind, I mingled with it and found a way by using client.

Thanks though.

Case Closed.


All times are GMT +2. The time now is 09:43 AM.

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