[Help] How to set up dying
#1

When my character gets killed theirs a loop that makes him die and die again. How can I make him spawn with full health again?
Reply
#2

Can anyone help me?
Reply
#3

Can u show us your OnPlayerDeath
Code pls
Reply
#4

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[64];
	GivePlayerMoney(playerid, -1000);
	GivePlayerMoney(playerid, 1000);
	format(string, sizeof(string), "KILL: You were killed by %s.", killerid);
	SendClientMessage(playerid, COLOR_RED, string);
	format(string, sizeof(string), "KILL: %s was killed by %s.",playerid,killerid);
	SendClientMessageToAll(COLOR_RED, string);
	if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
	if(playerid != INVALID_PLAYER_ID) SetPlayerScore(playerid, GetPlayerScore(killerid) - 1);
	return 1;
}
Reply
#5

Are you talking about the bug where someone dies and flops to the ground, then it happens a second time, then a 3rd time, etc... then stops and fully kills him, then the camera swings and respawns him?
Reply
#6

Well I type /rcon gravity 0 then /rcon gravity 1 wich kills me when I hit the ground. Then when I die I respawn and get kill again and again for ever.
Reply
#7

Change your gravity to default
Reply
#8

Default gravity is 0.008 and not 1 (When I was a beginner I made that mistake :P)
Quote:

GivePlayerMoney(playerid, -1000);
GivePlayerMoney(playerid, 1000);

So it removes 1000 dollar and then gives it back. Use 'killerid' instead of 'playerid' at the second one.

p.s.
Try gravity -1 ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)