Re: Help me with onplayerdeath -
gangster350 - 27.11.2010
Yeah right that i want but i cant do that
you know how to do?
Re: Help me with onplayerdeath -
WillyP - 27.11.2010
Yeah, but I'm doing shit ATM.
Re: Help me with onplayerdeath -
gangster350 - 27.11.2010
can you do me that when you are not Busy?
Re: Help me with onplayerdeath -
WillyP - 27.11.2010
Sure.
Re: Help me with onplayerdeath -
Auxxx - 27.11.2010
Wow, this topic is some hard shit. I wish I'd understand something he's saying... No Offence gangster350,
Re: Help me with onplayerdeath -
gangster350 - 27.11.2010
when you will stop be busy?
Re: Help me with onplayerdeath -
WillyP - 27.11.2010
Quote:
Originally Posted by gangster350
when you will stop be busy?
|
Not just yet.
Re: Help me with onplayerdeath -
gangster350 - 27.11.2010
@ 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
Re: Help me with onplayerdeath -
Auxxx - 27.11.2010
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;
}
Re: Help me with onplayerdeath -
gangster350 - 27.11.2010
thanks you Alot !!
: you can lock this topic
Re: Help me with onplayerdeath -
XePloiT - 27.11.2010
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 :\
Re: Help me with onplayerdeath -
Lilcuete - 27.11.2010
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;
}
Re: Help me with onplayerdeath -
Auxxx - 28.11.2010
Can't you guys read? I allready helped him out
Quote:
Originally Posted by gangster350
|
Any time, gangster350
Re: Help me with onplayerdeath -
gangster350 - 28.11.2010
Yes ! is fixed !
thanks you alot ! Auxxx