Need little help in this code - 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: Need little help in this code (
/showthread.php?tid=562205)
Need little help in this code -
LuisPark - 07.02.2015
Is there anyway for me to add freezetime in this code for 10sec, when finish, it will unfreeze the player and clear player's animation ? Help me please :d
PHP код:
CMD:datbanhlenxe(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu do vao luc nay.");
if(PlayerInfo[playerid][pRFLTeam] == 0)
{
SendClientMessageEx(playerid,COLOR_GREY," Ban chua nau banh pizza !");
}
else
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 10.0))
{
if(!IsABike(closestcar))
{
SendClientMessageEx(playerid,COLOR_GREY," Ban khong gan mot chiec xe nao do !");
}
if(PlayerInfo[playerid][pRFLTeam] == 1)
{
PlayerInfo[playerid][pFallIntoFun] = 1;
SendClientMessageEx(playerid,COLOR_YELLOW," Ban dang dua banh len xe , vui long cho");
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
}
}
}
return 1;
}
Re: Need little help in this code -
CalvinC - 07.02.2015
Use TogglePlayerControllable to freeze the player, then SetTimerEx to create a timer, in the timer use TogglePlayerControllable again and unfreeze the player.
Re: Need little help in this code -
LuisPark - 07.02.2015
I knew it, but i didnt know how to add, so i come here
Re: Need little help in this code -
CalvinC - 07.02.2015
This will set a timer of 10 seconds where he will be frozen:
pawn Код:
forward FreezeTimer(playerid);
public FreezeTimer(playerid) return TogglePlayerControllable(playerid, 1); // Makes the public function "FreezeTimer" unfreeze the player
CMD:datbanhlenxe(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu do vao luc nay.");
if(PlayerInfo[playerid][pRFLTeam] == 0)
{
SendClientMessageEx(playerid,COLOR_GREY," Ban chua nau banh pizza !");
}
else
{
new closestcar = GetClosestCar(playerid);
TogglePlayerControllable(playerid, 0); // Freezes the player
SetTimerEx("FreezeTimer", 10000, false, "i", playerid); // Sets the timer, using the public function "FreezeTimer"
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 10.0))
{
if(!IsABike(closestcar))
{
SendClientMessageEx(playerid,COLOR_GREY," Ban khong gan mot chiec xe nao do !");
}
if(PlayerInfo[playerid][pRFLTeam] == 1)
{
PlayerInfo[playerid][pFallIntoFun] = 1;
SendClientMessageEx(playerid,COLOR_YELLOW," Ban dang dua banh len xe , vui long cho");
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
}
}
}
return 1;
}