Is it possible to stop someone from spawning? - 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: Is it possible to stop someone from spawning? (
/showthread.php?tid=642395)
Is it possible to stop someone from spawning? -
grymtn - 29.09.2017
im trying to make a death system but i dont know why it doesnt work.
when i first die i get my
Код:
USER[playerid][DEATHS]
as 1 but when i die again my camera goes up to 6000 6000 6000 again and back i die again instead of spawning correctly after 30 second. Can anybody help? (btw if i walk in to fire after dying 30 seconds work properly but it doesnt when player kills me again or i use acceptdeath)
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
killerid=INVALID_PLAYER_ID;
reason=WEAPON_FLAMETHROWER;
RemovePlayerAttachedObject(playerid,9);
ClearAnimations(playerid);
RemovePlayerAttachedObject(playerid,9);
ClearAnimations(playerid);
USER[playerid][SMOKING]=0;
USER[playerid][GUN1]=0;
USER[playerid][GUN2]=0;
USER[playerid][GUN3]=0;
USER[playerid][AMMO1]=0;
USER[playerid][AMMO2]=0;
USER[playerid][AMMO3]=0;
USER[playerid][MONEY]=GetPlayerMoney(playerid);
if(USER[playerid][DEATHS]==1)
{
SetTimerEx("die",30000,false,"i",playerid);
SetPlayerCameraPos(playerid, 6000, 6000, 6000);
SetPlayerCameraLookAt(playerid, 6000, 6000, 6000);
TogglePlayerControllable(playerid,0);
return 1;
}
if(IsDead[playerid] == 1 && InCall[playerid] == 1 && Tallking[playerid] == 1) IsDead[playerid] = 1;
GetPlayerPos(playerid,pxd[playerid],pyd[playerid],pzd[playerid]);
if(USER[playerid][DEATHS]==0)
{
USER[playerid][DEATHS]=1;
SendClientMessage(playerid,COLOR_RED, "You are brutally wounded. If you don't get help, you will die.(/acceptdeath to die)");
}
return 1;
}
CMD:acceptdeath(playerid, params[])
{
if(USER[playerid][DEATHS]==1)
{
SetPlayerHealth(playerid,0.00);
}
return 1;
}
public die(playerid)
{
new Money = GetPlayerMoney(playerid);
new percentmoney = (Money/100)*5;
if(percentmoney > 999)
{
GivePlayerMoneyEx(playerid, -100);
ClearAnimations(playerid);
USER[playerid][DEATHS]=0;
SetPlayerHealth(playerid,100.0);
SetPlayerPos(playerid,1178.3056,-1323.2146,14.1135);
}
else
{
GivePlayerMoneyEx(playerid, -percentmoney);
ClearAnimations(playerid);
USER[playerid][DEATHS]=0;
SetPlayerHealth(playerid,100.0);
SetPlayerPos(playerid,1178.3056,-1323.2146,14.1135);
}
TogglePlayerControllable(playerid,1);
return 1;
}
Re: Is it possible to stop someone from spawning? -
Escobabe - 29.09.2017
I may be wrong, but why are you using the same codes on "public die"?
Re: Is it possible to stop someone from spawning? -
grymtn - 29.09.2017
i need a timer to spawn me after i prevent myself from spawning for the first 30 seconds right ? I mean i believe thats how it should be thats why i did that. well i must say this used to work before but i developed my game mode more and more. I can explain more like this i guess. when you die you fall to ground and camera moves away from you(thats how it was before and it was working), but now i dont fall to ground i instantly respawn after dying instantly like even before the code can be processed thru i spawn back. So i cant be dead for 30 seconds and camera moves back to player when i spawn because i cant stay dead.
EDIT: Also i tried "SendDeathMessage(playerid,killerid,reason);" i cant send death message too because respawn happens so quickly.
Re: Is it possible to stop someone from spawning? -
coool - 30.09.2017
Does player goes to spectating mode when died

?? if not try toggling spectating mode.