SA-MP Forums Archive
/kill issue. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /kill issue. (/showthread.php?tid=144090)



/kill issue. - TKZ227 - 25.04.2010

I probably did something stupid, but my /kill is all messed up. I just want the player to respawn at the hospital on death, yet this happens:

Movie_0004.wmv

Thanks in advance to any help!

EDIT: This doesn't just happen with /kill, it happens whenever you die, I just used /kill for example.


Re: /kill issue. - IamNotKoolllll - 25.04.2010

set the player pos after they die not before


Re: /kill issue. - TKZ227 - 25.04.2010

I have it set so "OnPlayerDeath", "SetPlayerPos(hospitalcoords)", then for /kill I just have the setplayerhealth 0 reset weapons, -350 bucks, send message.


Re: /kill issue. - Las Venturas CNR - 25.04.2010

Make sure that it will set the players health to 0.0 BEFORE you set their position.


Re: /kill issue. - TKZ227 - 25.04.2010

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	SetPlayerPos(playerid,1178.8807,-1323.7694,14.1419);
	SendClientMessage(playerid, COLOR_RED, "You have been critically injured, and lost 30 minutes of memory.");
	SendClientMessage(playerid, COLOR_RED, "You have paid $350 in hospital bills.");
    GivePlayerMoney(playerid, -350");
	return 1;
}



Re: /kill issue. - [MWR]Blood - 25.04.2010

pawn Код:
GivePlayerMoney(playerid,-350");
Without the "
pawn Код:
GivePlayerMoney(playerid,-350);
About the kill command:

pawn Код:
forward Kill(playerid);
forward Hospital(playerid);
public Kill(playerid)
{
SetPlayerHealth(playerid,0);
SetTimerEx("Hospital", 5000, 0,"e",playerid);
return 1;
}
public Hospital(playerid)
{
SetPlayerPos(playerid,pos);
return 1;
}
if(strcmp(cmdtext,"/kill",true)==0)
{
Kill(playerid);
return 1;
}
Should work!


Re: /kill issue. - TKZ227 - 25.04.2010

Quote:
Originally Posted by ikarus❶❸❸❼
pawn Код:
GivePlayerMoney(playerid,-350");
Without the "
pawn Код:
GivePlayerMoney(playerid,-350);
Yes, that was a mistake I made while copying, it's not actually like that, but thanks for pointing that out.


Re: /kill issue. - Luka P. - 25.04.2010

Make something like this

pawn Код:
new HospitalDeath[MAX_PLAYERS]; // Global variable
// We use HospitalDeath variable just to ensure that player is spawned already, so if player join the server and press Spawn button, he'll be spawned on normal spawn, not hospital
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    HospitalDeath[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, "You have been critically injured, and lost 30 minutes of memory.");
    SendClientMessage(playerid, COLOR_RED, "You have paid $350 in hospital bills.");
    GivePlayerMoney(playerid, -350);
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(HospitalDeath[playerid])
    {
        SetPlayerPos(playerid,1178.8807,-1323.7694,14.1419);
        HospitalDeath[playerid] = 0;
    }
    return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
     HospitalDeath[playerid] = 0;
     return 1;
}