SA-MP Forums Archive
freeze player before spawn - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: freeze player before spawn (/showthread.php?tid=202706)



freeze player before spawn - propilot - 24.12.2010

Hey, I have few Islands on my server and each of them has few spawn points I need to freeze the "player" for few seconds so he wont fall in water. Because objects takes 2-5 seconds to shows.
What should I add, I need to add timers?
If so please show me an example.
pawn Код:
case 26: { // civiliam spawn
            SetPlayerInterior(playerid,14);
            SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
            SetPlayerFacingAngle(playerid, 270.0);
            SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
            SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
            SetPlayerColor(playerid, 0x7F7F7FFF); // Gray
            SendClientMessage(playerid, 0x80FF00FF,"South Island Spawn");



Re: freeze player before spawn - Kitten - 24.12.2010

try using this
https://sampforum.blast.hk/showthread.php?tid=191112


Respuesta: freeze player before spawn - admantis - 24.12.2010

pawn Код:
//onplayerspawn
SetTimer("LoadObj",4000,0);
SendClientMessage(playerid,0xFFFFFFF,"Please wait the objects are loading");
TogglePlayerControllable(playerid,0);
pawn Код:
forward LoadObj(playerid);
public LoadObj(playerid);
{
SendClientMessage(playerid,0xFFFFFFF,"Objects loaded you can play now");
TogglePlayerControllable(playerid,1);
}



Re: freeze player before spawn - Retardedwolf - 24.12.2010

pawn Код:
public unFreeze ( tPlayer )
{
    TogglePlayerControllable ( playerid, true );
}
pawn Код:
SetTimerEx ( "unFreeze", 5000, false, "d", playerid );
TogglePlayerControllable ( playerid, false );

@admantis, your code won't work for players that have ids other than 0.


Respuesta: Re: freeze player before spawn - admantis - 24.12.2010

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
pawn Код:
public unFreeze ( tPlayer )
{
    TogglePlayerControllable ( playerid, true );
}
pawn Код:
SetTimerEx ( "unFreeze", 5000, false, "d", playerid );
TogglePlayerControllable ( playerid, false );

@admantis, your code won't work for players that have ids other than 0.
shit, i just realised that, lol..


Re: freeze player before spawn - propilot - 24.12.2010

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
pawn Код:
public unFreeze ( tPlayer )
{
    TogglePlayerControllable ( playerid, true );
}
pawn Код:
SetTimerEx ( "unFreeze", 5000, false, "d", playerid );
TogglePlayerControllable ( playerid, false );

@admantis, your code won't work for players that have ids other than 0.
Yours giving me errors.


Re: freeze player before spawn - Retardedwolf - 24.12.2010

Quote:
Originally Posted by propilot
Посмотреть сообщение
Yours giving me errors.
What errors?


Re: freeze player before spawn - Mikkel_Pedersen - 24.12.2010

Quote:
Originally Posted by propilot
Посмотреть сообщение
Yours giving me errors.
Keep in mind you have to forward the UnFreeze function aswell.

pawn Код:
forward UnFreeze( tPlayer );
public UnFreeze ( tPlayer )
{    
TogglePlayerControllable ( tPlayer, true );
}
Just noticed that in the public UnFreeze u wrote "tPlayer", but wrote "playerid" in the TogglePlayerControllable. Hopefully the code above should remove some of the errors you might get.


Re: freeze player before spawn - propilot - 24.12.2010

Wait I am messed up.
Can you please tell me where to put each function
what I know is
pawn Код:
forward UnFreeze( tPlayer );
top
but this is to unfreeze, which one do I use to freeze a player for 5+ secs


Re: freeze player before spawn - Mikkel_Pedersen - 24.12.2010

Something like:

pawn Код:
forward UnFreeze( tPlayer );//This
public UnFreeze ( tPlayer )
{    
    TogglePlayerControllable( tPlayer, true );
}//To this, can be whereever in the script u want (Just not inside other functions) Eventually just place it last in the script.

public OnPlayerSpawn(playerid)
{
    SetTimerEx ( "UnFreeze", 5000, false, "d", playerid );
    TogglePlayerControllable ( playerid, false );
    return 1;
}//And this should be placed under OnPlayerSpawn (As I showed) Just remember not to copy "public OnPlayerSpawn(playerid) as u probably already got it.