Help me with onplayerdeath
#21

Yeah right that i want but i cant do that you know how to do?
Reply
#22

Yeah, but I'm doing shit ATM.
Reply
#23

can you do me that when you are not Busy?
Reply
#24

Sure.
Reply
#25

Wow, this topic is some hard shit. I wish I'd understand something he's saying... No Offence gangster350,
Reply
#26

when you will stop be busy?
Reply
#27

Quote:
Originally Posted by gangster350
Посмотреть сообщение
when you will stop be busy?
Not just yet.
Reply
#28

@ Auxxx Look, the player dies and then he stays dead at the same position until he types
/AccepDeath... after this he respawns at the same position...

if you can help
Reply
#29

I'm not sure, that this is what you mean, but It's working, I tested it out...


At the top of your script:
pawn Код:
new Float: deathx, Float:deathy, Float:deathz;
and then somewhere there, put:

pawn Код:
public OnPlayerDeath(playerid)
{
    GetPlayerPos(playerid, deathx, deathy, deathz);
    SetPVarInt(playerid, "Death", 1);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/acceptdeath", cmdtext, true, 10) == 0)
    {
        if(GetPVarInt(playerid, "Death") == 0) return SendClientMessage(playerid, 0xFF4646FF, "You are not dead.");
        GivePlayerMoney(playerid, -500);
        SetPVarInt(playerid, "Death", 0);
        SetPlayerPos(playerid, deathx, deathy, deathz);
    }
    return 1;
}
Reply
#30

thanks you Alot !! : you can lock this topic
Reply
#31

try this one...i guess its not perfect but maybe it will be enough:
pawn Код:
new Float:PoX,PoY,PoZ,start=1;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmd,"/ad",true))
    {
         SetPlayerHealth(playerid,100);
         SetPlayerPos(playerid,PoX,PoY,PoZ);
         ClearAnimations(playerid);
         return TogglePlayerControllable(playerid,1);
    }
    return 0;
}

public OnPlayerSpawn(playerid)
{
    if(first!=1)
    {
        ApplyAnimation(playerid,"PED","KO_skid_front",4.1, 0,0,0,1,0);
        TogglePlayerControllable(playerid,0);
                      SetPlayerHealth(playerid,99999);
        return SetPlayerPos(playerid,PoX,PoY,PoZ);
    }
     return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    first=0;
    GetPlayerPos(playerid,PoX,PoY,PoZ);
           return 1;
}
try this and tell me if this works :\
Reply
#32

Just put this in OnPlayerDeath
pawn Код:
IsDead[playerid] = 1; GetPlayerPos(playerid, deadx[playerid], deady[playerid], deadz[playerid]);
    DeadInt[playerid] = GetPlayerInterior(playerid);
    DeadWorld[playerid] = GetPlayerVirtualWorld(playerid);
and add this for variables
pawn Код:
new DeadInt[MAX_PLAYERS];
new DeadWorld[MAX_PLAYERS];
new Float:deadx[MAX_PLAYERS],Float:deady[MAX_PLAYERS],Float:deadz[MAX_PLAYERS]; new IsDead[MAX_PLAYERS];
Use must have this so it can return player pos where he was dead at.
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
   
    return 0;
}
Add this in OnPayerSpawn
pawn Код:
if(IsDead[playerid] == 1) {

            SetPlayerPos(playerid, deadx[playerid], deady[playerid], deadz[playerid]);
            SetPlayerInterior(playerid, DeadInt[playerid]);
            SetPlayerVirtualWorld(playerid, DeadWorld[playerid]);
            SetPlayerCameraPos(playerid, deadx[playerid], deady[playerid], deadz[playerid]+5);
            SetPlayerCameraLookAt(playerid, deadx[playerid], deady[playerid], deadz[playerid]);
            SendClientMessage(playerid, COLOR_LIGHTRED, "You were brutally wounded,now if a medic or anyone else doesn't save you,you will die.");
            SendClientMessage(playerid, COLOR_LIGHTRED, "To accept death type /acceptdeath.");
            TogglePlayerControllable(playerid, 0);
            ApplyAnimation(playerid,"PED","KO_skid_front",4.1,0,1,1,1,0);
   
            gPlayerUsingLoopingAnim[playerid] = 1;
            return 1;
        }
Reply
#33

Can't you guys read? I allready helped him out

Quote:
Originally Posted by gangster350
Посмотреть сообщение
thanks you Alot !! : you can lock this topic
Any time, gangster350
Reply
#34

Yes ! is fixed ! thanks you alot ! Auxxx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)