SA-MP Forums Archive
FreezePlayer for wait loading object HELP - 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: FreezePlayer for wait loading object HELP (/showthread.php?tid=258184)



FreezePlayer for wait loading object HELP - Dr.Ghost - 29.05.2011

help guys

pawn Код:
dcmd_island(playerid,params[])
{
    #pragma unused params
    SetPlayerPos(playerid, 829.37,-2432.32,1.80);
    SetPlayerInterior(playerid,0);
    SetTimer(FreezePlayer,5000);
    TogglePlayerControllable(playerid,0);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~g~Wellcome tot ~w~/island",2000,3);
    SendClientMessageToAll(0x00FF00FF, "Come Join Us too use commands: /island");
    GameTextForPlayer(playerid,"WELCOME TO ISLAND",4000,5);
    return 1;
}
forward FreezePlayer();
public FreezePlayer()
{
    GameTextForPlayer(playerid,"wait loading object",5000,5);
    TogglePlayerControllable(playerid,1);
    return 1;
}


when compile:

Код:
C:\Documents and Settings\user\Desktop\SAMP SERVER 0.3c\gamemodes\[GM]Clan.pwn(2631) : error 076: syntax error in the expression, or invalid function call
C:\Documents and Settings\user\Desktop\SAMP SERVER 0.3c\gamemodes\[GM]Clan.pwn(2641) : error 017: undefined symbol "playerid"
C:\Documents and Settings\user\Desktop\SAMP SERVER 0.3c\gamemodes\[GM]Clan.pwn(2642) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: FreezePlayer for wait loading object HELP - Mike Garber - 29.05.2011

First of all a timer starts x milliseconds AFTER you have executed it;
Your code will freeze the player 5 seconds AFTER he was teleported, not for five seconds when he is teleported.

So what you do is, to freeze the player FIRST then run a timer to UNFREEZE the player.
pawn Код:
// In the command;
GameTextForPlayer(playerid,"wait loading object",5000,5);
TogglePlayerControllable(playerid,0);
SetTimerEx("UnFreezePlayer",5000,0,"i",playerid);
// And

forward UnFreezePlayer(playerid);
public UnFreezePlayer(playerid)
{
    TogglePlayerControllable(playerid,1);
}
EDIT: Edited a few times, now it is the final solution.


Re: FreezePlayer for wait loading object HELP - SkizzoTrick - 29.05.2011

Yes,as ****** said,you have to use it as a string.
But i truelly suggest you to use this instead of simple timer:
pawn Код:
SetTimerEx("FreezePlayer",5000,false,"i",playerid);
EDIT:Wrong,i didn't see the post above sorry.


Re: FreezePlayer for wait loading object HELP - Dr.Ghost - 29.05.2011

yes problem solved. Big thanks all guys ..