totalled cars & teams/skins help
#1

Hi guys, i'm trying to add a '''totalled'' car system, so if the vehicle goes like 7% health it will stop and you can't start the engine or drive. please give me some tips about this so I can make the totalled car system myself. My other problem is I'm trying to add alll skins without adding addplayerclass one by one. if someone knows a working short code for please reply this thread. that's all help that i need. thnks.
Reply
#2

bump.
Reply
#3

For the totalled car system, you canf irst get the vehicle's health using GetVehicleHealth and then after that use SetVehicleParamsEx to switch off it's engine

For the addplayerclass thing, I guess you can make an array with all the id's and then process it 1 by 1 in the addplayerclass function
Reply
#4

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
For the totalled car system, you canf irst get the vehicle's health using GetVehicleHealth and then after that use SetVehicleParamsEx to switch off it's engine

For the addplayerclass thing, I guess you can make an array with all the id's and then process it 1 by 1 in the addplayerclass function
Thank you so much. I just don't know how to use this. "GetVehicleHealth"
Can you give one example?

Here's the engine cmd
Quote:
Код:
dcmd_engine(playerid, params[])
{
#pragma unused params
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, playername[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, playername, sizeof(playername));
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
    return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
if(engine == 1)
{
	SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine shut off.");
}
else
{
    SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine started.");
}
return 1;
}
Edit: About the skins, I will try.
Reply
#5

The max health of a vehicle is 1000, 7% would be 70. Although, we cant detect if it's 70 cuz i believe around 200 or something the car is on fire.

To use the function, just create a new Float:carhealth;
Then get the vehicle ID of the player and then get the health for that vehicle id which will be stored in the variable carhealth

Example -
pawn Код:
new Float:health;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
Reply
#6

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
The max health of a vehicle is 1000, 7% would be 70. Although, we cant detect if it's 70 cuz i believe around 200 or something the car is on fire.

To use the function, just create a new Float:carhealth;
Then get the vehicle ID of the player and then get the health for that vehicle id which will be stored in the variable carhealth

Example -
pawn Код:
new Float:health;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, health);
And yeah, if it reaches 0 health I don't want to make it doesn't explode (unless the car is upside down without driver in it), any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)