Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Please help finish my script (https://forums.graalonline.com/forums/showthread.php?t=65597)

Coolkid77742 04-23-2006 03:34 AM

Please help finish my script
 
Ok I need my script so it will always be active

//#CLIENTSIDE
if (weaponfired) {
for (i=1;i!=0;i++) {
playermp=i*1;
sleep .95;
}}

Thats what I got

Angel_Light 04-23-2006 03:41 AM

This should be in the GS1 area really. But, use a timeout.

Coolkid77742 04-23-2006 03:43 AM

uh can u show me im so confsued

ZeLpH_MyStiK 04-23-2006 03:47 AM

Quote:

Originally Posted by Coolkid77742
uh can u show me im so confsued

If you're so confused, start with something easier.
And "Please help finish my script"? Bad title. No we will not help you finish it. If you want us to help you understand it, sure.
This is what you have so far:
PHP Code:

//#CLIENTSIDE
if (weaponfired) {  // if the wNPC is fired
for (i=1;i!=0;i++) {  // a for loop that is apparently ever increasing
playermp=i*1;  // setting playermp to i * 1, no idea why you'd multiply by 1 plus playermp can't be set clientside
sleep .95;  // sleeping for .95 seconds.
}}  // bad styling btw 


xXziroXx 04-23-2006 04:56 AM

A timeout:


NPC Code:

if (timeout) {
timeout = #; // Replace # with a number
}


Bl0nkt 04-23-2006 05:39 AM

***** @ i*1;

Just by looking at what you're doing, it looks like you're trying to make a sliding effect. That would look like this:

NPC Code:
//#CLIENTSIDE
if (weaponfired) {
for (i=playermp;i<100;i++) {
sleep 0.1;
playermp=i;
}
}



But in your case, you probably want to do this:

NPC Code:
//#CLIENTSIDE
if (created) timeout = 0.05;

if (timeout) {
playermp = 100;
timeout = 0.05;
}


Angel_Light 04-23-2006 01:31 PM

//#CLIENTSIDE
if (created) {
timeout = 0.05;
}


if (timeout) {
playermp = 100;
timeout = 0.05;
}

-_- Use brackets right

Skyld 04-23-2006 02:08 PM

playermp cannot be set clientside. You had might as well do something like this on the serverside:
PHP Code:

if (created)
{
  
timeout 0.5;
}

if (
timeout)
{
  if (
playermp 100)
  {
    
playermp ++;
  }
 
  
timeout 0.5;



ZeLpH_MyStiK 04-23-2006 06:49 PM

Quote:

Originally Posted by Angel_Light
//#CLIENTSIDE
if (created) {
timeout = 0.05;
}


if (timeout) {
playermp = 100;
timeout = 0.05;
}

-_- Use brackets right

You don't need brackets after the if (created). I normally do the same when it's just one command following the statement. i.e.
PHP Code:

if (playerchatssetplayerprop #c,omg!; 

Adding brackets to just one line when it's already easily understood is just a waste of time and space.

Angel_Light 04-24-2006 01:17 PM

Meh, it looks better Zelph. ;o Also you use a triggeraction on the clientside to server for the MP

Skyld 04-24-2006 01:39 PM

Quote:

Originally Posted by Angel_Light
Meh, it looks better Zelph. ;o Also you use a triggeraction on the clientside to server for the MP

It's quite inefficient to send however many triggeractions from the clientside, when you could just run the operation serverside.

xAndrewx 04-24-2006 07:08 PM

I'm currently wondering why you've chosen to use the timeout feature.
A 'for()' loop works the same...?

Skyld 04-24-2006 08:40 PM

Quote:

Originally Posted by xAndrewx
I'm currently wondering why you've chosen to use the timeout feature.
A 'for()' loop works the same...?

A for () loop needs an initiator, making it just as easy to use a timeout.

Angel_Light 04-25-2006 03:31 AM

All... hail... Skyld... o.o;

anyways... He might have some clientside only actions or stuff of the such. That's why suggested that.

Raeiphon 04-26-2006 04:03 PM

On the subject of triggeractions, couldn't you locate a function above the //#CLIENTSIDE statement and when called, it would run serverside?


All times are GMT +2. The time now is 07:15 PM.

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