Cmd: Car engine help
#1

Hey, When I turn of my car engine in game it does not say for other people when I turn of my engine, and on other servers when you turn of your vehicles engine it said for other people like "John has turned off their engine".
How do I get this to show for other players?

Code:
Quote:

forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,li ghts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
DeletePVar(playerid, "fuelonoff");
DestroyProgressBar(FuelBar[playerid]);
textdrawscount--;
FuelBar[playerid] = INVALID_BAR_ID;
arr_Engine{vehicleid} = 0;
}
else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
{
new
Float: f_vHealth;

GetVehicleHealth(vehicleid, f_vHealth);
if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
if(VehicleFuel[vehicleid] <= 0.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lig hts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/car engine to turn the engine off).");
arr_Engine{vehicleid} = 1;
if(GetChased[playerid] < 999 && VehicleBomb[vehicleid] == 1)
{
if(PlayerInfo[playerid][pHeadValue] >= 1)
{
if(PlayerInfo[GetChased[playerid]][pMember] == 8 || PlayerInfo[GetChased[playerid]][pLeader] == 8 )
{
new Float:boomx, Float:boomy, Float:boomz;
GetPlayerPos(playerid,boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
VehicleBomb[vehicleid] = 0;
PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
GivePlayerCash(GetChased[playerid], takemoney);
GivePlayerCash(playerid, -takemoney);
format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),PlayerInfo[playerid][pHeadValue] / 4 * 2);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
ResetPlayerWeaponsEx(playerid);
// SpawnPlayer(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pHeadValue] = 0;
PlayerInfo[GetChased[playerid]][pCHits] += 1;
SetPlayerHealth(playerid, 0.0);
// KillEMSQueue(playerid);
GoChase[GetChased[playerid]] = 999;
PlayerInfo[GetChased[playerid]][pC4Used] = 0;
PlayerInfo[GetChased[playerid]][pC4] = 0;
GotHit[playerid] = 0;
GetChased[playerid] = 999;
return 1;
}
}
}

SetPVarInt(playerid, "fuelonoff", 1);
FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
textdrawscount++;
SetProgressBarValue(FuelBar[playerid], VehicleFuel[vehicleid]);
ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
}
return 1;
}

Reply
#2

pawn Код:
forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,li ghts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
new str[60];
format(str, sizeof(str), "%s turns off his car's engine.", name);
SendClientMessageToAll(-1, str);
DeletePVar(playerid, "fuelonoff");
DestroyProgressBar(FuelBar[playerid]);
textdrawscount--;
FuelBar[playerid] = INVALID_BAR_ID;
arr_Engine{vehicleid} = 0;
}
else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
{
new
Float: f_vHealth;

GetVehicleHealth(vehicleid, f_vHealth);
if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
if(VehicleFuel[vehicleid] <= 0.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lig hts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/car engine to turn the engine off).");
new str1[60];
format(st1r, sizeof(str1), "%s turns off his car's engine.", name);
SendClientMessageToAll(-1, str1);

arr_Engine{vehicleid} = 1;
if(GetChased[playerid] < 999 && VehicleBomb[vehicleid] == 1)
{
if(PlayerInfo[playerid][pHeadValue] >= 1)
{
if(PlayerInfo[GetChased[playerid]][pMember] == 8 || PlayerInfo[GetChased[playerid]][pLeader] == 8 )
{
new Float:boomx, Float:boomy, Float:boomz;
GetPlayerPos(playerid,boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
VehicleBomb[vehicleid] = 0;
PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
GivePlayerCash(GetChased[playerid], takemoney);
GivePlayerCash(playerid, -takemoney);
format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),PlayerInfo[playerid][pHeadValue] / 4 * 2);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
ResetPlayerWeaponsEx(playerid);
// SpawnPlayer(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pHeadValue] = 0;
PlayerInfo[GetChased[playerid]][pCHits] += 1;
SetPlayerHealth(playerid, 0.0);
// KillEMSQueue(playerid);
GoChase[GetChased[playerid]] = 999;
PlayerInfo[GetChased[playerid]][pC4Used] = 0;
PlayerInfo[GetChased[playerid]][pC4] = 0;
GotHit[playerid] = 0;
GetChased[playerid] = 999;
return 1;
}
}
}

SetPVarInt(playerid, "fuelonoff", 1);
FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
textdrawscount++;
SetProgressBarValue(FuelBar[playerid], VehicleFuel[vehicleid]);
ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
}
return 1;
}
Reply
#3

Something like
Quote:

SendClientMessageToAll(color, %s Has turned The engine off);

%s getting player name
Reply
#4

Quote:

forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,li ghts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
new str[60];
format(str, sizeof(str), "%s turns off his car's engine.", name);
SendClientMessageToAll(-1, str);
DeletePVar(playerid, "fuelonoff");
DestroyProgressBar(FuelBar[playerid]);
textdrawscount--;
FuelBar[playerid] = INVALID_BAR_ID;
arr_Engine{vehicleid} = 0;
}
else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
{
new
Float: f_vHealth;

GetVehicleHealth(vehicleid, f_vHealth);
if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
if(VehicleFuel[vehicleid] <= 0.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lig hts,alarm,doors,bonnet,boot,objective);
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/car engine to turn the engine off).");
new str1[60];
format(st1r, sizeof(str1), "%s turns off his car's engine.", name);
SendClientMessageToAll(-1, str1);

arr_Engine{vehicleid} = 1;
if(GetChased[playerid] < 999 && VehicleBomb[vehicleid] == 1)
{
if(PlayerInfo[playerid][pHeadValue] >= 1)
{
if(PlayerInfo[GetChased[playerid]][pMember] == 8 || PlayerInfo[GetChased[playerid]][pLeader] == 8 )
{
new Float:boomx, Float:boomy, Float:boomz;
GetPlayerPos(playerid,boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
VehicleBomb[vehicleid] = 0;
PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
GivePlayerCash(GetChased[playerid], takemoney);
GivePlayerCash(playerid, -takemoney);
format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),PlayerInfo[playerid][pHeadValue] / 4 * 2);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
ResetPlayerWeaponsEx(playerid);
// SpawnPlayer(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pHeadValue] = 0;
PlayerInfo[GetChased[playerid]][pCHits] += 1;
SetPlayerHealth(playerid, 0.0);
// KillEMSQueue(playerid);
GoChase[GetChased[playerid]] = 999;
PlayerInfo[GetChased[playerid]][pC4Used] = 0;
PlayerInfo[GetChased[playerid]][pC4] = 0;
GotHit[playerid] = 0;
GetChased[playerid] = 999;
return 1;
}
}
}

SetPVarInt(playerid, "fuelonoff", 1);
FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
textdrawscount++;
SetProgressBarValue(FuelBar[playerid], VehicleFuel[vehicleid]);
ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
}
return 1;
}

Thanks! +Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)