/kill issue.
#1

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.
Reply
#2

set the player pos after they die not before
Reply
#3

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

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

Код:
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;
}
Reply
#6

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!
Reply
#7

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.
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)