SA-MP Forums Archive
vehicle health - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vehicle health (/showthread.php?tid=592397)



vehicle health - alexanderjb918 - 24.10.2015

Код:
C:\Users\Imdaking\Desktop\New Folder (6)\Roleplay.pwn(5446) : error 017: undefined symbol "VehicleHealth"
C:\Users\Imdaking\Desktop\New Folder (6)\Roleplay.pwn(5446) : warning 215: expression has no effect
C:\Users\Imdaking\Desktop\New Folder (6)\Roleplay.pwn(5446) : error 001: expected token: ";", but found "]"
C:\Users\Imdaking\Desktop\New Folder (6)\Roleplay.pwn(5446) : error 029: invalid expression, assumed zero
C:\Users\Imdaking\Desktop\New Folder (6)\Roleplay.pwn(5446) : fatal error 107: too many error messages on one line
Код:
else if(!strcmp(params, "park", true, 4))
 	{
 		if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not inside any vehicle.");
		new vehicleid = GetPlayerVehicleID(playerid);
		new id = GetVehicleID(vehicleid);
		if(GetPlayerVehicleAccess(playerid, id) < 1)
		return SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have the keys for this vehicle.");

  		new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);

		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
		SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);

		VehicleHealth[id] = GetVehicleHealth(id, health);
		GetVehiclePos(VehicleID[id], VehiclePos[id][0], VehiclePos[id][1], VehiclePos[id][2]);
		GetVehicleZAngle(VehicleID[id], VehiclePos[id][3]);
		VehicleInterior[id] = GetPlayerInterior(playerid);
		VehicleWorld[id] = 100;
		SaveVehicle(id);
error line : VehicleHealth[id] = GetVehicleHealth(id, health);


Re : vehicle health - StreetRP - 24.10.2015

PHP код:
else if(!strcmp(params"park"true4))
     {
         if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_LIGHTRED"You are not inside any vehicle.");
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
id GetVehicleID(vehicleid);
        if(
GetPlayerVehicleAccess(playeridid) < 1)
        return 
SendClientMessage(playeridCOLOR_LIGHTRED"You don't have the keys for this vehicle.");
          new 
Float:xFloat:yFloat:z,Float:carhealth;
        
GetPlayerPos(playeridxyz);
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
SetVehicleParamsEx(vehicleid0000000);
        
GetVehicleHealth(idcarhealth);
        
VehicleHealth[id] = carhealth;
        
GetVehiclePos(VehicleID[id], VehiclePos[id][0], VehiclePos[id][1], VehiclePos[id][2]);
        
GetVehicleZAngle(VehicleID[id], VehiclePos[id][3]);
        
VehicleInterior[id] = GetPlayerInterior(playerid);
        
VehicleWorld[id] = 100;
        
SaveVehicle(id); 
Try


Re : vehicle health - alexanderjb918 - 24.10.2015

Same errors.


Re : vehicle health - StreetRP - 24.10.2015

Quote:

new VehicleHealth[MAX_VEHICLES];

in top of you'r script


Re: vehicle health - PrO.GameR - 24.10.2015

VehicleHealth[id] = GetVehicleHealth(id, health);
^^^ this line is wrong in probably one/bot of these issues:
A) GetVehicleHealth doesn't return the health, it works like GetPlayerName
B) Declare VehicleHealth as float if you didn't already
C) You should send the function the actual vehicle ID, not the array ID of it (doubt they are same in your code, they are same in mine tho.)

Right way to use:
Quote:

GetVehicleHealth(vehicleid, VehicleHealth[id]);