29.06.2013, 21:35
What is this?
This is basically something very simple. I used IsPlayerArea and added SetPlayerHealth. So basically when a player enters a specific area of the map (something very tiny usually, since it's a landmine), GameTextForPlayer will appear on the screen for 2 seconds, saying: "You have stepped on a landmine!" and the player's health will be set to 0. He will die. I've also added so when you enter the area, a sound will play.
Pretty much I'd just like to get some additions from you.
This is basically something very simple. I used IsPlayerArea and added SetPlayerHealth. So basically when a player enters a specific area of the map (something very tiny usually, since it's a landmine), GameTextForPlayer will appear on the screen for 2 seconds, saying: "You have stepped on a landmine!" and the player's health will be set to 0. He will die. I've also added so when you enter the area, a sound will play.
PHP код:
forward isPlayerInArea();
SetTimer("isPlayerInArea", 1000, 1);
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z; //
for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
{
GetPlayerPos(i, X, Y, Z); //
if (X <= -3915 && X >= -3694 && Y <= 401 && Y >= 37)
{
SetPlayerHealth(i, -999999.9); //Player is killed as he enters the area
}
}
PlayerPlaySound(playerid, 1159, X, Y, Z);
}