(help) WATER
#1

is posible to creat a timer that give -5hp each 10seconds only if the player is in water ?
Reply
#2

yes it is but i forgot the code where if your lower than the cords then u get whatever u put
Reply
#3

so no on 1 know that function ?
Reply
#4

This code will only work as long as a player is not in a vehicle
pawn Код:
stock IsPlayerInWater(playerid)
{
    new animlib[32],tmp[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
    if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid)) return true;
    return false;
}
Reply
#5

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
This code will only work as long as a player is not in a vehicle
pawn Код:
stock IsPlayerInWater(playerid)
{
    new animlib[32],tmp[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,tmp,32);
    if(!strcmp(animlib, "SWIM") && !IsPlayerInAnyVehicle(playerid)) return true;
    return false;
}
but if the player is in water !! it works or not ?
Reply
#6

Yes it works I use it and it works 100%
Reply
#7

so what's thй problйm for mй this what i put & nothing
Код:
stock IsPlayerInWater(playerid)
{
        new animlib[32], animname[32];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(strcmp(animlib, "SWIM", true) == 0)
		{
		    if(team[playerid] == 2) return 1;
		    if(team[playerid] == 6) return 1;
    		    SetPlayerDrunkLevel (playerid, 400)
      		    GameTextForPlayer(playerid, "~r~ Water is infected ", 3000, 4);
		}
}
Reply
#8

aah shit that's not tha sam thing
sory but still wont work
Reply
#9

IsPlayerInWater doesn't call itselves..
Reply
#10

Put the orginal stock function at the bottom of your script. Then do something like this:
pawn Код:
//OnPlayerConnect:
SetTimerEx("blah", 1000, 1, "i", playerid); //You might want to kill or something like that when the player disconnect
//Bottom of your script:
forward Blah(playerid);

public Blah(playerid)
{
    if(IsPlayerInWater(playerid) && team[playerid] ! = 2 || team[playerid] ! = 6)
    {
        SetPlayerDrunkLevel (playerid, 400);
        GameTextForPlayer(playerid, "~r~ Water is infected ", 3000, 4);
    }
    return 1;
}
Note: This was just an example of how to do it so dont just copy and paste and expect it to work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)