freeze player before spawn
#1

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");
Reply
#2

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

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);
}
Reply
#4

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.
Reply
#5

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..
Reply
#6

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.
Reply
#7

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

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.
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)