OnPlayerDeath + Spawn
#1

Hi,

First of all read this carefully (I'm 100 percent sure what i have done).

My problem is, anytime when i die or use command to kill myself it send me to class(skin selection)! It should spawn me instead! I'm 100 percent sure, I don't have anything in code what could cause this problem!

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(killerid, 5000);
    PlayerInfo[killerid][deaths]++;
    PlayerInfo[playerid][kills]++;
}
In OnPlayerSpawn i just have random spawns there and in kill command i just have setplayerhealth to 0, that's it!
Reply
#2

Add SpawnPlayer(playerid); to the callback.
Reply
#3

Now, It sending multiple death message
Reply
#4

Anyone know what could cause this problem ? Thanks
Reply
#5

You need to check if killerid is valid before using it as an array index! Otherwise you'll get out-of-bounds errors that cause unexpected behavior.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
You need to check if killerid is valid before using it as an array index! Otherwise you'll get out-of-bounds errors that cause unexpected behavior.
I done it, problem is same im getting to class selection after death
Reply
#7

Anyone ? TNX
Reply
#8

Quote:

Now, It sending multiple death message

Before you call SpawnPlayer, make sure you've set the player's health to 100 or anything above 1, if else this would cause the player to die an infinite times.

If that doesn't work out, make sure you've set the spawn info by SetSpawnInfo
Reply
#9

Maybe you have Spectating Functions under the /kill command or somewhere else related to the death.
Reply
#10

I have this, nowhere else is something about death + command /kill is only setplayerhealth to 0 nothing else

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(killerid, 5000);
    PlayerInfo[killerid][deaths]++;
    PlayerInfo[playerid][kills]++;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)