[+REP] OnEnterExitModShop Problem -
norton2 - 24.05.2015
Not update Damage Status for vehicle.
Not Set Health Vehicle correctly.
Код HTML:
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
new veh = GetPlayerVehicleID(playerid);
new panels, doorss, lightss, tires;
if(enterexit == 1)
{
GetVehicleDamageStatus(veh, panels, doorss, lightss, tires);
GetVehicleHealth(veh, healthh);
}
if(enterexit == 0)
{
UpdateVehicleDamageStatus(veh, panels, doorss, lightss, tires);
SetVehicleHealth(veh, healthh);
}
return 1;
}
Re: [+REP] OnEnterExitModShop Problem -
Bingo - 24.05.2015
I guess it is supposed to be :
Код:
SetVehicleHealth(veh, 1000);
Re: [+REP] OnEnterExitModShop Problem -
norton2 - 24.05.2015
No.
I want to have health vehicle as when he entered the mods shop.
Re: [+REP] OnEnterExitModShop Problem -
Yashas - 24.05.2015
Your code doesn't work because what ever you data you store in local variables will be lost once the function is executed.That means that when a player enters a mod shop, you save the information and when he exits whatever you saved wouldn't be there since the callback is called separately for entering and exiting.
The solution would be to use global variables which do not lose data when the scope of a function ends.
Код:
new Float:pVehicleH[MAX_PLAYERS];
new pVehiclePanels[MAX_PLAYERS];
new pVehicleDoors[MAX_PLAYERS];
new pVehicleLights[MAX_PLAYERS];
new pVehicleTires[MAX_PLAYERS];
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
new veh = GetPlayerVehicleID(playerid);
if(enterexit == 1)
{ GetVehicleDamageStatus(veh,pVehiclePanels[playerid],pVehicleDoors[playerid],pVehicleLights[playerid],pVehicleTires[playerid]);
GetVehicleHealth(veh,pVehicleH[playerid]);
}
else
{
UpdateVehicleDamageStatus(veh,pVehiclePanels[playerid],pVehicleDoors[playerid],pVehicleLights[playerid],pVehicleTires[playerid]);
SetVehicleHealth(veh,pVehicleH[playerid]);
}
}
Re: [+REP] OnEnterExitModShop Problem -
norton2 - 24.05.2015
Thank you very much man!
For 5 days you will receive 1+rep from me.
Re: [+REP] OnEnterExitModShop Problem -
Yashas - 24.05.2015
Quote:
Originally Posted by norton2
Thank you very much man!
For 5 days you will receive 1+rep from me.
PS:
WRONG: new pVehicleH[MAX_PLAYERS];
CORRECTLY: new Float: pVehicleH[MAX_PLAYERS];
|
Thanks for you kindness.But one rep would do for me.
Thanks for letting me know, I must have been a little careless.
Reply edited.Anyone who would be checking this thread in future won't simply copy that code.