Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Is it possible to stop someone from spawning?

$
0
0
im trying to make a death system but i dont know why it doesnt work.

when i first die i get my

Code:

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)

Code:

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;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>