Poll

yes?

no.
18 (31.6%)
yes.
9 (15.8%)
quesadilla.
30 (52.6%)

Total Members Voted: 57

Author Topic: Smoking  (Read 4005 times)

function a()
{
     cancel($a);

     ..code..

     $a = schedule(1000,0,a);
}


Then how do I activate and deactivate it?

that's.. probably not exactly what he wants..
Code: [Select]
function SmokeLoop(%on) //loop things, call SmokeLoop(1); to start.
{
cancel($SmokeSchedule); //Cancel the schedule so it isn't still going.
if(!%on) //If it's disabled, end it. call smokeloop(0); to stop it
return; //actually end it
callthisfunction(1); //Call this function
$SmokeSchedule = schedule([TIME HERE], 0, SmokeLoop, 1); //Lets do it again!
}

My guts are going to flow out of my face like a loving river on bath salts
hahahaah oh god sig'd

How do I call one function through another function is basicly what I'm trying to ask.

function a()
{
     cancel($a);

     ..code..

     $a = schedule(1000,0,a);
}

or you could just mount emitter to image and loop through states >_>

How do I call one function through another function is basicly what I'm trying to ask.
did you read my post
or even elms uncommented post


or maybe
or you could just mount emitter to image and loop through states >_>
maybe you could do it this way, like it's supposed to

Well I ran into a problem.

First off, when I use /smoke it does toggle between the messages
Problem #1: It shows %name SPC you are now smoking.
Not
Yola you are now smoking.

Problem #2: Smoking never happens.

I'm off to bed for now, maybe you'll leave me some helpful info in the morning.

Script as of now:

Code: [Select]
function serverCmdSmoke(%client)
{
switch($smoketoggle)
{
case true:
$smoketoggle = false;
SmokeLoop(1);
%name = $Pref::Player::NetName;
messageClient(%client,'',"\c6%name SPC you are now smoking");

case false:
$smoketoggle = true;
SmokeLoop(0);
%name = $Pref::Player::NetName;
messageClient(%client,'',"\c6%name SPC you are done smoking");
}
}

function Smoke(%client)
{
serverplay3d(Smokingsound,%client.player.getHackPosition() SPC "0 0 1 0");
echo(%client.name @ " smoke");
%client.player.setWhiteout(0.5);
%client.player.emote(DrugsmokeImage);
}

function SmokeLoop(%on)
{
cancel($SmokeSchedule);
if(!%on)
return;
Smoke(1);
%time = getrandom(1000,2000);
$SmokeSchedule = schedule(%time, 0, SmokeLoop, 1);
}

what the forget is that formatting holy stuff

found your problem

messageClient(%client,'',"\c6%name SPC you are now smoking");

lets blow this up so it's easier to read

"\c6%name SPC you are now smoking"

observe

"\c6" @ %name SPC "you are now smoking"

also your word choice is abysmal, not to mention various other errors that will crop up.
let me do this:

Code: [Select]
function serverCmdSmoke(%this)
{
SmokeLoop(%this.isSmoking);
messageClient(%this, '', "\c6" @ %this.getPlayerName() SPC "is no((%this.isSmoking) ? "w" : " longer") SPC "smoking."
%this.isSmoking = !%this.isSmoking;
}

function GameConnection::Smoke(%this)
{
// echo(%client.name @ " smokes"); //debug
// %client.player.setWhiteout(0.5); //why
if(isObject(%this.player))
%this.player.emote(DrugsmokeImage);
}

function GameConnection::SmokeLoop(%this, %on)
{
cancel(%this.SmokeSchedule);
if(!%on)
return;
%this.Smoke();
%this.SmokeSchedule = %this.schedule(getrandom(1000, 2000), SmokeLoop, 1);
}
Where is drugSmokeImage defined?
« Last Edit: June 18, 2012, 01:15:00 AM by Lugnut1206 »




And no one took up on my bong and bowl idea? Pfffft :c

Don't let yola do it, god
Please, learn how to script before doing stuff, you still don't know what causes syntax errors


-snip-
Hurr lets fix bad formatting with bad formatting.
Code: [Select]
function serverCmdSmoke(%this)
{
messageClient(%this, '', "\c6" @ %this.getPlayerName() SPC "is no((%this.isSmoking) ? "w" : " longer") SPC "smoking."
   if(%this.issmoking)
      %this.unmountimage(0);
   else
      %this.mountImage(0,drugsmokeimage);
   %this.issmoking=!%this.issmoking;
}
Then use states on the image to loop the emitter.
As long as you make the image correct it should work.
No garuntees though since I edited on a crappy phone.
I would suggest moving the slot number too

Don't let yola do it, god
Please, learn how to script before doing stuff, you still don't know what causes syntax errors
...
Well then.
I suppose I definitely didn't completely write a script that mounts the cigarette model, plays it's animation, and loops through it...

Well, the only thing left to do is finish coloring the model.

Heres it so far:


Does that cigarette look too big, too small?