PDA

View Full Version : Please help finish my script


Coolkid77742
04-23-2006, 04:34 AM
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, 04:41 AM
This should be in the GS1 area really. But, use a timeout.

Coolkid77742
04-23-2006, 04:43 AM
uh can u show me im so confsued

ZeLpH_MyStiK
04-23-2006, 04:47 AM
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:

//#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, 05:56 AM
A timeout:



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

Bl0nkt
04-23-2006, 06: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:

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

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

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

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

Angel_Light
04-23-2006, 02:31 PM
//#CLIENTSIDE
if (created) {
timeout = 0.05;
}


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

-_- Use brackets right

Skyld
04-23-2006, 03:08 PM
playermp cannot be set clientside. You had might as well do something like this on the serverside:
if (created)
{
timeout = 0.5;
}

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

timeout = 0.5;
}

ZeLpH_MyStiK
04-23-2006, 07:49 PM
//#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.

if (playerchats) setplayerprop #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, 02: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, 02:39 PM
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, 08: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, 09:40 PM
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, 04: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, 05:03 PM
On the subject of triggeractions, couldn't you locate a function above the //#CLIENTSIDE statement and when called, it would run serverside?

ApothiX
04-26-2006, 05:59 PM
On the subject of triggeractions, couldn't you locate a function above the //#CLIENTSIDE statement and when called, it would run serverside?
You cannot call serverside functions from the clientside. To do such a thing you would have to do like:

function MyKewlFunction(mykewlparam) {
echo("WEee: " @ mykewlparam);
}

function onActionServerside() {
if(params[0] == "mykewlfunction") {
MyKewlFunction(params[1]);
}
}

//#CLIENTSIDE
function onWeaponFired() {
triggerserver("gui", "MyKewlWeapon", "mykewlfunction", "OMG CALLED FROM CLIENTSIDE");
}