new Text:Textdraw5; Textdraw5 = TextDrawCreate(486.000000, 123.000000, "Temperature : 99'F"); TextDrawBackgroundColor(Textdraw5, 255); TextDrawFont(Textdraw5, 1); TextDrawLetterSize(Textdraw5, 0.370000, 1.100000); TextDrawColor(Textdraw5, -1); TextDrawSetOutline(Textdraw5, 1); TextDrawSetProportional(Textdraw5, 1); TextDrawUseBox(Textdraw5, 1); TextDrawBoxColor(Textdraw5, 255); TextDrawTextSize(Textdraw5, 620.000000, 0.000000);
IsPlayerSwimming(playerid)
{
new animlib[32];
new animname[32];
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
if(!strcmp(animlib, "SWIM")) return 1;
return 0;
}
Get the player's position (x, y, z)
If z value is less then 1.0, then the player is on water. |
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,sizeof(animlib),animname,sizeof(animname));
if(strcmp(animname,"SWIM_ANIM")==0)
{
ur textdraws
}
NOTE: this is just an example on how to do it,,i dont even know the anim name of swimming XD
stock IsPlayerInWater(playerid) { if(IsPlayerInAnyVehicle(playerid)) { new Float:pnX,Float:pnY,Float:pnZ; GetPlayerPos(playerid,pnX,pnY,pnZ); if(pnZ < 1.5)return 1; if((IsPlayerInRangeOfPoint(playerid, 300.0, -1168.11,2151.00,40.0) || IsPlayerInRangeOfPoint(playerid, 300.0, -958.11,2401.0,40.0) || IsPlayerInRangeOfPoint(playerid, 300.0, -1084.94,2649.50,40.04))&& pnZ < 45)return 1; if((IsPlayerInRangeOfPoint(playerid, 100.0, 1962.16,1599.64,10.0) || IsPlayerInRangeOfPoint(playerid, 50.0, 2147.28,1131.29,10.0) || IsPlayerInRangeOfPoint(playerid, 30.0, 1237.01,-2378.30,10.0) || IsPlayerInRangeOfPoint(playerid, 50.0, 2108.07,1907.37,10.0)) && pnZ < 10)return 1; if(IsPlayerInRangeOfPoint(playerid, 50.0, 13129.3950,973.4327,17.45) && pnZ < 20)return 1; } return 0; }
pawn Код:
|