03.04.2016, 16:43
Quote:
If this is what you need. It does something like if you are in vehicle then you will be visible with that textdraw. When you exit it hides.
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { GetPlayerPos(i, x, y, z); distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2)); value = floatround(distance * 5600); new Float:tmph; GetVehicleHealth(GetPlayerVehicleID(i), tmph); //format(string, sizeof(string), "~r~Health:~w~ %.0f%% ~n~~r~Time:~w~ %02d:%02d~n~~r~Weapon:~w~%s~n~~r~Money: ~w~пїЅ%s~n~~r~Vehicle: ~w~%s~n~~r~Fuel:~w~ %d%%~n~~r~Speed: ~w~%d", aWeaponNames[GetPlayerWeapon(i)], number_format(PlayerTemp[i][sm]), GetVehicleName(GetPlayerVehicleID(i)), Gas[GetPlayerVehicleID(i)], floatround(value/600)); format(string, sizeof(string), "~r~Speed: ~w~%d KM/H~n~~r~Fuel: ~w~%d%%~n~~r~Health: ~w~%d%", floatround(value/600), Gas[GetPlayerVehicleID(i)], floatround(floatdiv(tmph,10))); TextDrawSetString(PlayerTemp[i][Status], string); if(Gas[GetPlayerVehicleID(i)] <= 10 && IsPlayerDriver(i)) TDWarning(i, "you are running out of fuel!", 1400); if(Gas[GetPlayerVehicleID(i)] <= 0 && IsPlayerDriver(i)) RemovePlayerFromVehicle(i), SendClientInfo(i, "No fuel!"); SavePlayerPos[i][LastX] = x; SavePlayerPos[i][LastY] = y; SavePlayerPos[i][LastZ] = z; return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { TextDrawHideForPlayer(playerid,PlayerTemp[playerid][Status]); return 1; } |
The whole public is this
pawn Код:
public CheckGas()
{
new string[164];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if( GetPlayerState(i) == PLAYER_STATE_DRIVER
|| IsPlayerInAnyVehicle(i) && GetPlayerWeapon(i) == 24) SetPlayerArmedWeapon(i, 0);
if(!PlayerTemp[i][adminduty])
{
if(PlayerTemp[i][oocmode]) SetPlayerChatBubble(i, "(( OOC MODE - DO NOT ROLEPLAY WITH THIS PERSON ))", COLOR_ADMIN_SPYREPORT, 40.0, 2000);
if(PlayerTemp[i][helperduty])
{
format(iStr, sizeof(iStr), "(( HELPERDUTY ))");
SetPlayerChatBubble(i, iStr, 0xe70909AA, 50.0, 10000);
}
}
else
{
format(iStr, sizeof(iStr), "(( ADMINDUTY ))");
SetPlayerChatBubble(i, iStr, 0xe70909AA, 50.0, 10000);
}
GetPlayerPos(i,X250[i],Y250[i],Z250[i]);
new Float:pH, Float:pA;
GetPlayerHealth(i, pH);
GetPlayerArmour(i, pA);
new Float:x,Float:y,Float:z;
new Float:distance,value;
if(!IsPlayerInAnyVehicle(i))
{
//format(string, sizeof(string), "~r~Health:~w~ %.0f%% ~n~~r~Time:~w~ %02d:%02d~n~~r~Weapon: ~w~%s~n~~r~Money: ~w~пїЅ%s",pH, t[0], t[1], aWeaponNames[GetPlayerWeapon(i)], number_format(PlayerTemp[i][sm]));
//format(string, sizeof(string), "~g~Health:~w~ %.0f%%~n~~g~Weapon: ~w~%s~n~~g~Money: ~w~$%s", pH, aWeaponNames[GetPlayerWeapon(i)], number_format(PlayerTemp[i][sm]));
TextDrawSetString(PlayerTemp[i][Status], string);
if(tazed[ i ]) ApplyAnimation(i,"CRACK", "crckdeth2", 4.1, 0, 0, 0, 1, 1); // irl crack!
}
else
{
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 5600);
new Float:tmph;
GetVehicleHealth(GetPlayerVehicleID(i), tmph);
//format(string, sizeof(string), "~r~Health:~w~ %.0f%% ~n~~r~Time:~w~ %02d:%02d~n~~r~Weapon:~w~%s~n~~r~Money: ~w~пїЅ%s~n~~r~Vehicle: ~w~%s~n~~r~Fuel:~w~ %d%%~n~~r~Speed: ~w~%d", aWeaponNames[GetPlayerWeapon(i)], number_format(PlayerTemp[i][sm]), GetVehicleName(GetPlayerVehicleID(i)), Gas[GetPlayerVehicleID(i)], floatround(value/600));
format(string, sizeof(string), "~r~Speed: ~w~%d KM/H~n~~r~Fuel: ~w~%d%%~n~~r~Health: ~w~%d%", floatround(value/600), Gas[GetPlayerVehicleID(i)], floatround(floatdiv(tmph,10)));
TextDrawSetString(PlayerTemp[i][Status], string);
if(Gas[GetPlayerVehicleID(i)] <= 10 && IsPlayerDriver(i)) TDWarning(i, "you are running out of fuel!", 1400);
if(Gas[GetPlayerVehicleID(i)] <= 0 && IsPlayerDriver(i)) RemovePlayerFromVehicle(i), SendClientInfo(i, "No fuel!");
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}
}
return 1;
}