Interior change problem - 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)
+--- Thread: Interior change problem (
/showthread.php?tid=308015)
Interior change problem -
Tanush123 - 01.01.2012
I was making a city hall so i made a CP outside a building in SF and it teleports them to city hall. after when the 1 second timer finishes they get tped back outside SF City Hall. How i fix this?
I want to use the yellow marker to exit and that works good
Example
*Tanush goes inside the Checkpoint outside SF building
*Tanush teleports there and been frozen 1 second and unfreezed
*Tanush takes one step and it auto teleports him outside the SF building
Onplayerinteriorchange
pawn Код:
if(insfhall[playerid] == 1)
{
insfhall[playerid] = 0;
SetTimerEx("SFhall",2000,0,"i",playerid);
}
OnplayerenterdynamicCP
pawn Код:
else if(checkpointid == cityhallout)
{
SetTimerEx("Obj",1000,0,"i",playerid);
TogglePlayerControllable(playerid,0);
SetPlayerInterior(playerid,3);
SetPlayerVirtualWorld(playerid,1);
SetPlayerFacingAngle(playerid,98.0517);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid,387.0217,173.8155,1008.382);
}
The settimerex("obj..
pawn Код:
SendClientMessage(playerid,lightyellow,"You been frozen for 1 seconds because the objects were loading, you are free to move now");
TogglePlayerControllable(playerid,1);
Re: Interior change problem -
Tanush123 - 02.01.2012
bump
Re: Interior change problem -
parames3010 - 02.01.2012
thank
Re: Interior change problem -
Max_Coldheart - 02.01.2012
Do you also have exit point in the place you're placing the players? That could cause the exit code to be instantly executed when teleported inside, and to be teleported outside.
Re: Interior change problem -
Tanush123 - 02.01.2012
sorry i dont get what you mean?
Re: Interior change problem -
Dark_Kostas - 02.01.2012
As you use CP, you can use the OnPlayerEnterCheckpoint callback instead of a timer. Also you can have something like a cooldown after entering/exiting from somewhere. So you can have a var like this one. Each time you enter/exit somewhere change it to 5 and then each second reduce it by 1. Only if its equal to 0 let him enter.
Example:
pawn Код:
OnOneSecondTimer(playerid)
{
if (EnterExitCoolDown[playerid] > 0) EnterExitCoolDown[playerid] --;
if (EnterExitCoolDown[playerid] == 0)
{
//your position check
if PLAYER_AT_ENTER_POINT
{
Teleport_Him
EnterExitCoolDown[playerid] = 5;
}
}
}