Hi Guys, i have a question: how i can make that a player can't move for (example) 20 seconds?
after the 20 seconds he can move?
If you ask what i want to make:
The Map is starting, 20 seconds and the game begins :)
Printable View
Hi Guys, i have a question: how i can make that a player can't move for (example) 20 seconds?
after the 20 seconds he can move?
If you ask what i want to make:
The Map is starting, 20 seconds and the game begins :)
link player to script origin:
To lock:
org = spawn("script_origin",self.origin);
self linkTo(org);
To unlock:
self unlink();
So you mean: [code]
org = spawn("script_origin",self.origin);
self linkTo(org);
wait(20);
self unlink();
But don't forget to delete the helper-model then. On the other hand you don't need a model for each player, one model for all works also.
PHP Code:
// ONLY ONCE:
level.helper = spawn("script_origin", (0,0,0))
// for each player:
player linkTo(level.helper);
wait 20;
player unlink();
Hi, this i get it if i have test it:
script:Code:******* script compile error *******
bad syntax: (file 'maps/mp/gametypes/_begin.gsc', line 9)
self linkTo(level.waiter);
*
************************************
Code:init()
{
thread waiting();
}
waiting()
{
level.waiter = spawn("script_origin", (0,0,0))
self linkTo(level.waiter);
wait 20;
self unlink();
}
I said with bold text: ONLY ONCE
If you can't understand that, use:
PHP Code:
init()
{
thread waiting();
}
waiting()
{
if ( ! isDefined(level.waiter))
level.waiter = spawn("script_origin", (0,0,0)); // you forget the ; here
self linkTo(level.waiter);
wait 20;
self unlink();
}
hmm it didnt work, i have try to make script_model but it doesnt work too.
my error:
Code:******* script runtime error *******
struct is not an entity: (file 'maps/mp/gametypes/_begin.gsc', line 10)
self linkTo(level.waiter);
*
You need to call the functions on a player, now the functions work with "level".
hmmm idk what you mean ;(
Try freezecontrols() instead.
What? I have nothing understand. Sorry, can you please add this here what do you mean?
Code:init()
{
thread waiting();
}
waiting()
{
if ( ! isDefined(level.waiter))
level.waiter = spawn("script_origin", (0,0,0)); // you forget the ; here
self linkTo(level.waiter);
wait 20;
self unlink();
}
Dude, you need something like: player waiting();
Try to understand what "self" means by reading more code in tdm.gsc e.g.
ATM you are doing: level waiting(); which is bullshit of course
Hmm i tried that but the error says Unknown Function: players[i] freezeplayer();
Code:init()
{
thread waiting();
}
waiting()
{
players = getentarray("player", "classname");
for (i = 0; i<players.size; i++)
{
players[i] freezeplayer();
wait 20;
players[i] unfreeze();
}
}
freezecontrols(true) not freezeplayer()
This works:
PHP Code:
main()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for( ;; )
{
level waittill( "connected", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for( ;; )
{
self waittill( "spawned_player" );
self thread Freeze();
}
}
Freeze()
{
self iprintlnbold( "frozen" );
self freezeControls( true );
wait( 10 );
self iprintlnbold( "unfrozen" );
self freezeControls( false );
}
THANK YOU EVOLLLUZZZ & TALLLY YOU ARE RIGHT!!!!!!!!!!
Ok Guys, that not work, idk really why, i have set it in my mp_sad.gsc, i have run the map and it doesn't work.
If map started, then waiting 1 secound, then freeze, that doesnt work.Code:main()
{
// Map name: mp_sad (test map)
maps\mp\_load::main();
maps\mp\_kiste1::main(); // Zufallskiste Nr.1
thread begin(); // Here if map starts then you have to wait 20 secounds
}
begin()
{
wait(1);
players = getentarray("player", "classname");
for (i = 0; i<players.size; i++)
{
players[i] freezecontrols(true);
wait 20;
players[i] freezecontrols(false);
}
}
And i think because: If you are not in the map, in the exact second 29:59, then it should start but i come too late, and i will be not stuck.
Somebody know how else i can make it?
I must create in Callback_startgametype a timer or in my map.gsc, so that if you connect and it looking for the timer, which secound i am? How long it left now?
I think this is not easy and i asked my friends, they can't maybe some of killtubers, but would be very nice if somebody is here and can help
There are 3 problems with that code:
1. You must check that the entarray for players exists. If not, then wait for it to be defined;
2. You aren't waiting for the players to spawn. They cannot move until they are spawned;
3. You are waiting 20 seconds in the for() loop to search for all players. This will mean the loop will wait 20 seconds before it moves on to the next player. In that time, the player will be able to run around.
So, try this:
EDIT - the code I just wrote also has a problem - it will only wait until the first player connects, and then run. You really need to detect every connecting player, and run the thread on them. Hence, my original code I posted is much much better because it does exactly that - it detects each and every player and runs the freeze thread on them as they spawn. You need to put that original code in there instead.PHP Code:
main()
{
// Map name: mp_sad (test map)
maps\mp\_load::main();
maps\mp\_kiste1::main(); // Zufallskiste Nr.1
thread begin(); // Here if map starts then you have to wait 20 secounds
}
begin()
{
wait(1);
players = getentarray("player", "classname");
while( !isDefined( players ) )
wait( 0.05 );
for( i = 0; i < players.size; i++ )
players[i] thread FreezePlayer();
}
FreezePlayer()
{
self endon( "disconnect" );
self waittill( "spawned_player" );
self freezecontrols(true);
wait( 20 );
self freezecontrols(false);
}