OnPlayerDeath - Problem
#1

Hey!

I got problem with my OnPlayerDeath public or callback.
If i die, the server puts me in random spawns and change my skin to CJ's.

- Sometimes if I die, then the server says: "Stay within the world Boundries". And the monitor starts blinging (white-white-white).
______________

Here's my callback:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	DoHospital(playerid);
	pStats[playerid][pHospitalized] = 1;
	// Teeb skinni korda
	SetPlayerSkin(playerid, GetPlayerSkin(playerid));
	pStats[playerid][pSkin] = GetPlayerSkin(playerid);
//  -------------------------------------------------
	pStats[playerid][pCopDuty] = 0;
	DisablePlayerCheckpoint(playerid);
//  -------------------------------------------------

	OnPlayerDataSave(playerid);
	return 1;
}
And DoHospital callback:

Код:
public DoHospital(playerid)
{
	SendClientMessage(playerid, COLOR_YELLOW2, "Sa oled kriitiliselt vigastatud ja sind viidi haiglasse!");
	SetPlayerPos(playerid, 1236.6205,306.6172,26.3991);
	SetPlayerCameraPos(playerid, 1199.2200,296.6742,33.2644);
	SetPlayerCameraLookAt(playerid, 1223.1254,304.0070,19.5754);
	SetPlayerFacingAngle(playerid, 90.0769);
	TogglePlayerControllable(playerid, false);
	SetTimerEx("ReleaseFromHospital", 50000, 0, "d", playerid);
	SetPlayerInterior(playerid, 0);
   	SetPlayerVirtualWorld(playerid, 0);
	return 1;
}

Thanks,
Arcanize
Reply
#2

This may help:
https://sampwiki.blast.hk/wiki/SetPlayerWorldBounds
Reply
#3

You should put DoHospital in OnPlayerSpawn. Else ur setting player pos when not spawned etc.
Reply
#4

Tried, put still nothing...
Reply
#5

Ideas?
Reply
#6

Check to make sure "OnPlayerDeath()" is being called.
Reply
#7

Sorry, but I don't get the point now...
Reply
#8

Quote:
Originally Posted by Arcanize
Посмотреть сообщение
Sorry, but I don't get the point now...
Okay, put this under "OnPlayerDeath():"

pawn Код:
print("\nIt appears OnPlayerDeath is being called properly.\n");
Go ahead and run your server and have your character die. Check the console, see if the message above appears.
Reply
#9

Yes, the message arrives but that text comes again...
Reply
#10

Double but...


Can the problem be in OnPlayerSpawn public?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)