Page 1 of 1

Need a correction to my code!

Posted: Wed Mar 11, 2009 2:53 pm
by SilentAngel
I need to make a code that, after the player spawn says something (the player..)
I tried this one but don't work

Code: Select all

while (1)
{
 for (local.i = 1; local.i <= $player.size; local.i++) 
 {
  if ($player[local.i] respawn)
  {
   $player[local.i] stufftext ("say hello..the trick works!!")
  }
 }
}
end
can someone tell me what's wrong? tx

Posted: Wed Mar 11, 2009 4:58 pm
by $oldier Of Ra
Your loop, for one, has no wait. MoH will automatically unload any script with a risk for a dangerous loop.

And "$player[local.i] respawn" doesn't make any sense in the first place, since the respawn command, respawns the player and the fact it's being used in an if statement is completely preposterous.

Detecting spawn is a lot harder than this. Either do it by using the states (like so many have done before) or do it properly by script.

Try sorrids spawn detect. Just execute in the dmprecache. And use the scripts he added.
http://www.modtheater.com/forum/showthread.php?t=27915

Posted: Wed Mar 11, 2009 6:26 pm
by SilentAngel
oops :oops: I've forgot the wait lol
also I was almost sure that respawn have no sense, but I needed to be sure of that and I asked

Posted: Thu Mar 12, 2009 4:07 pm
by $oldier Of Ra
Asked who? Clearly the person you asked had no idea.

Posted: Sat Mar 14, 2009 9:05 am
by jv_map
$oldier Of Ra wrote:Asked who? Clearly the person you asked had no idea.
Lol :)

(oof this could be my most useless post ever :/)

Posted: Sat Mar 14, 2009 1:28 pm
by SilentAngel
Asked who? Clearly the person you asked had no idea.
loool..probably you're right..

Posted: Sat Mar 14, 2009 5:47 pm
by Rookie One.pl
My hovercraft is full of eels.

Jv, I think I beat you to it. :)

Posted: Sat Mar 14, 2009 6:23 pm
by SilentAngel

Code: Select all

for (local.me = 1; local.me = $paunch.size; local.me++)
{
   if ( local.me.needs_food == 1)
   {
        local.me stufftext "gimme an hotdog!"
wait 0.1
        local.me stufftext "gimme another one!!"
   }
}
end // for now...lol
:lol: