OnPlayerUpdate -
Blackazur - 29.12.2012
Quote:
if(IsPlayerInWater(playerid)) return SetPlayerHealth(playerid,0.0);
|
How can i make that a Message come like "Player X has jumped into infected Water and died."?
Re: OnPlayerUpdate -
FTLOG - 29.12.2012
You can use GameTextForPlayer(..., or you can create a global bool variable, and do this for instance:
pawn Код:
new bool:is_message_Sent[ MAX_PLAYERS ];
public OnPlayerUpdate( playerid ) {
if(IsPlayerInWater(playerid)) {
SetPlayerHealth(playerid,0.0);
if( is_message_Sent[ playerid ] == false ) {
SendClientMessage( playerid, 0xFFFFFFFF, "You died." );
is_message_Sent[ playerid ] = true;
return true;
}
}
}
public OnPlayerSpawn( playerid ) {
is_message_Sent[ playerid ] = false;
return true;
}
Try this if you don't want GameText-s.
Re: OnPlayerUpdate -
Konstantinos - 29.12.2012
Inside the if statement about if he is in water, get player's name, format a message, send it to all, kill the player and return true.
AW: OnPlayerUpdate -
Blackazur - 29.12.2012
Код:
if(IsPlayerInWater(playerid)) return SetPlayerHealth(playerid,0.0);
format(str,144,"«| %s Has Jumped Into Infected Water And Died. |»",PlayerName[playerid]);
SendClientMessageToAll(COLOR_CYAN,str);
Then the Message spammed the full Chat, lol.
Re: OnPlayerUpdate -
Alternative112 - 29.12.2012
It's probably because IsPlayerInWater keeps returning true.
You will want to do something like this:
Код:
if(IsPlayerInWater(playerid) && GetPlayerHealth(playerid) > 0.0) {
SetPlayerHealth(playerid, 0.0);
format(str,144,"«| %s Has Jumped Into Infected Water And Died. |»",PlayerName[playerid]);
SendClientMessageToAll(COLOR_CYAN, str);
}
If that doesn't work you can get really dirty with it and make an array killedInWater[MAX_PLAYERS], and then manually change it to 1 or 0 to ensure the message doesn't show up again, but life is too short for that.
AW: OnPlayerUpdate -
Blackazur - 29.12.2012
warning 202: number of arguments does not match definition
On the Line: if(IsPlayerInWater(playerid) && GetPlayerHealth(playerid) > 0.0) {
Re : OnPlayerUpdate -
lelemaster - 29.12.2012
new Float:health;
GetPlayerHealth(playerid, health);
if(IsPlayerInWater(playerid) && health > 0.0)
AW: OnPlayerUpdate -
Blackazur - 29.12.2012
Thanks, all works now.
AW: OnPlayerUpdate -
Blackazur - 30.12.2012
I have a Problem, when a Player the 2 Time or 3 Time, goto Water and die, the Message "Has Jumped Into Infected Water And Died" spammed.
Код:
if(IsPlayerInWater(playerid)) {
SetPlayerHealth(playerid, 0.0);
format(str,144,"«| %s Has Jumped Into Infected Water And Died.|»",PlayerName[playerid]);
SendClientMessageToAll(COLOR_CYAN, str);
How to fix that?