Random numbers
Moderator: Core Staff
Random numbers
is it possible to generate random numbers in codscript?
Re: Random numbers
Code: Select all
RandomInt( <max> )
Re: Random numbers
thanks alot , do you know if there's a method for checking if a user activated a trigger?
Re: Random numbers
well i am not a good scripter but i'll try to help youpcbouncer wrote:thanks alot , do you know if there's a method for checking if a user activated a trigger?
example of code:
Code: Select all
thread_name()
{
trigger = getent("trig_1","targetname");
Â
  while (1)
  {
Â
   trigger waittill ("trigger", player );
Â
   if ( isPlayer( player ) && isAlive( player ) && isdefined( player.done ) )
       {
        //when player touch the trigger for 2nd,3rd..ect
        }
   else
     {
Â
//when the player touch the trigger for the first time
player iprintlnbold ("Congratulations, " + player.name + ", you have completed the map!"); Â
Â
  wait 0.5;
Â
     player.done = true;
Â
     }
  }
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Random numbers
pcbouncer wrote:thanks alot , do you know if there's a method for checking if a user activated a trigger?
Code: Select all
function()
{
  trigger_ent = getent("trigger_targetname", "targetname")
Â
  while(1)
  {
   trigger_ent waittill("trigger", user)
   iprintlnbold("Player " + user.name + " ^7activated the trigger");
 }
}
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Random numbers
Stay out of the mapping section.randomjumper wrote:well, here are some numbers for you:
...i hope thats enough np
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 24 guests