OnPlayerDeath/GivePlayerMoney
#1

Hi, how i could make a spawn when someone die and give him a message like:

*me died*
You were critically injured, your medical bill is 2000$
give him -2000$

and spawn him here:

Quote:

AddPlayerClass(0,-320.2867,1052.6426,20.3403,341.9651,0,0,0,0,0,0); // OnPlayerDeath

Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(playerid, -2000);
    SendClientMessage(playerid, 0xFF0000AA, "You have died. Your medical bill is: $2000");
    GameTextForPlayer(playerid, "~r~Medical Bills: $2000", 5000, 5);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(playerid, -2000);
    SendClientMessage(playerid, 0xFF0000AA, "You have died. Your medical bill is: $2000");
    GameTextForPlayer(playerid, "~r~Medical Bills: $2000", 5000, 5);
    return 1;
}
or you would do

Quote:

public OnPlayerDeath(playerid, killerid, reason)
{
GivePlayerMoney(playerid, -2000);
SendClientMessage(playerid, 0xFF0000AA, "You have died. Your medical bill is: $2000");
GameTextForPlayer(playerid, "~r~Medical Bills: $2000", 5000, 5);
SetPlayerPos(playerid, ,-320.2867,1052.6426,20.3403);
return 1;
}

Reply
#4

Quote:
Originally Posted by jueix
Посмотреть сообщение
or you would do
Ahh I didn't see the last bit... but no... that would set his position, then he would simply respawn somewhere else...

Can you please show me your OnPlayerSpawn function, so then I can edit it so you can respawn at that location.
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Ahh I didn't see the last bit... but no... that would set his position, then he would simply respawn somewhere else...

Can you please show me your OnPlayerSpawn function, so then I can edit it so you can respawn at that location.
I use something like this.

Quote:

new dead[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
if(Dead[playerid] != 0) { //basicly its saying that if the value = 0 it will tele him to the spawn point.
SetPlayerPos(playerid,,-320.2867,1052.6426,20.3403); //this is the hospital when you die
Dead[playerid] = 0;
}
else {
SetPlayerPos(playerid, x, y, z);// this teles you to spawn point when they pick a class first time
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
Dead[playerid] = 1;
return 1;
}

Reply
#6

That's a very complex way of putting it... it could be alot simpler, but without having seen his OnPlayerSpawn function, I cannot generate the code for it...
Reply
#7

Do it with jueix's way, because actually you cannot Set the position of players on the OnPlayerDeath Callback, because the player is already dead and after that take place the OnPlayerSpawn part.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)