CMD:ripara(playerid, params[]) { new id=GetPlayerVehicleID(playerid); if(PlayerToPoint(6.0, playerid, 992.987121,-1659.088134,14.559866) || PlayerToPoint(6.0, playerid, 992.834289,-1650.768920,14.559599) && IsPlayerInAnyVehicle(playerid)) { new Float:health; new str[128]; new Float:vh = GetVehicleHealth(id,health); new vhealth = floatround(vh, floatround_round); new totale = 999-vhealth; RepairVehicle(id); format(str,sizeof(str),"Hai riparato il tuo veicolo per %i", totale); SCM(playerid, INFO, str); GivePlayerMoney(playerid, -totale); SetVehicleHealth(id, 999.0); VeicoloInfo[(id)][vVita] = 999.0; Salvaveh((id)); Salvataggio(playerid); } return 1; }
PHP код:
|
CMD:ripara(playerid, params[])
{
new id=GetPlayerVehicleID(playerid);
if(PlayerToPoint(6.0, playerid, 992.987121,-1659.088134,14.559866) || PlayerToPoint(6.0, playerid, 992.834289,-1650.768920,14.559599) && IsPlayerInAnyVehicle(playerid))
{
new Float:health;
new str[128];
new Float:vh = GetVehicleHealth(id,health); // pasta pizza bambino, you don't need here to create a new Float:vh as you've already retrieved the vehicle's health on the variable health.
new vhealth = floatround(vh, floatround_round); // pasta pizza bambino, you need to change vh for health again here
new totale = 999-vhealth;
RepairVehicle(id);
format(str,sizeof(str),"Hai riparato il tuo veicolo per %i", totale);
SCM(playerid, INFO, str);
GivePlayerMoney(playerid, -totale);
SetVehicleHealth(id, 999.0);
VeicoloInfo[(id)][vVita] = 999.0;
Salvaveh((id));
Salvataggio(playerid);
}
return 1;
}
GetVehicleHealth(id,health); new vhealth = floatround(health);
Ok but I want to show the current life of the vehicle in 1000. How do I?
|
SetVehicleHealth(id, 999.0);
if(PlayerToPoint(6.0, playerid, 992.987121,-1659.088134,14.559866) || PlayerToPoint(6.0, playerid, 992.834289,-1650.768920,14.559599) && IsPlayerInAnyVehicle(playerid))
if( ( PlayerToPoint(6.0, playerid, 992.987121,-1659.088134,14.559866) || PlayerToPoint(6.0, playerid, 992.834289,-1650.768920,14.559599) ) && IsPlayerInAnyVehicle(playerid))