(help) WATER - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: (help) WATER (
/showthread.php?tid=216812)
(help) WATER -
Amine_Mejrhirrou - 26.01.2011
is posible to creat a timer that give
-5hp each 10seconds
only if the player is in water ?
Re: (help) WATER -
hadzx - 26.01.2011
yes it is but i forgot the code where if your lower than the cords then u get whatever u put
Re : (help) WATER -
Amine_Mejrhirrou - 26.01.2011
so no on 1 know that function ?
Re: (help) WATER -
Fj0rtizFredde - 26.01.2011
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;
}
Re : Re: (help) WATER -
Amine_Mejrhirrou - 26.01.2011
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 ?
Re: (help) WATER -
Fj0rtizFredde - 26.01.2011
Yes it works

I use it and it works 100%
Re : (help) WATER -
Amine_Mejrhirrou - 26.01.2011

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);
}
}
Re : (help) WATER -
Amine_Mejrhirrou - 26.01.2011
aah shit that's not tha sam thing
sory but still wont work
Re: (help) WATER -
DVDK - 26.01.2011
IsPlayerInWater doesn't call itselves..
Re: (help) WATER -
Fj0rtizFredde - 26.01.2011
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