Need a correction to my code!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Need a correction to my code!

Post 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
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Asked who? Clearly the person you asked had no idea.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 :/)
Image
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Asked who? Clearly the person you asked had no idea.
loool..probably you're right..
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

My hovercraft is full of eels.

Jv, I think I beat you to it. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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:
Post Reply