For that message use:
Put this somewhere at your script.
pawn Код:
NearMessageSender(playerid, Float:radius, string[], COLOR1, COLOR2, COLOR3, COLOR4, COLOR5)
{
new Float:Position[3], Float:iPosition[3], Float:cPosition[3];
GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
GetPlayerPos(i, iPosition[0], iPosition[1], iPosition[2]);
cPosition[0] = (Position[0] - iPosition[0]);
cPosition[1] = (Position[1] - iPosition[1]);
cPosition[2] = (Position[2] - iPosition[2]);
if(((cPosition[0] < radius/16) && (cPosition[0] > -radius/16)) && ((cPosition[1] < radius/16) && (cPosition[1] > -radius/16)) && ((cPosition[2] < radius/16) && (cPosition[2] > -radius/16)))
{
SendClientMessage(i, COLOR1, string);
}
else if(((cPosition[0] < radius/8) && (cPosition[0] > -radius/8)) && ((cPosition[1] < radius/8) && (cPosition[1] > -radius/8)) && ((cPosition[2] < radius/8) && (cPosition[2] > -radius/8)))
{
SendClientMessage(i, COLOR2, string);
}
else if(((cPosition[0] < radius/4) && (cPosition[0] > -radius/4)) && ((cPosition[1] < radius/4) && (cPosition[1] > -radius/4)) && ((cPosition[2] < radius/4) && (cPosition[2] > -radius/4)))
{
SendClientMessage(i, COLOR3, string);
}
else if(((cPosition[0] < radius/2) && (cPosition[0] > -radius/2)) && ((cPosition[1] < radius/2) && (cPosition[1] > -radius/2)) && ((cPosition[2] < radius/2) && (cPosition[2] > -radius/2)))
{
SendClientMessage(i, COLOR4, string);
}
else if(((cPosition[0] < radius) && (cPosition[0] > -radius)) && ((cPosition[1] < radius) && (cPosition[1] > -radius)) && ((cPosition[2] < radius) && (cPosition[2] > -radius)))
{
SendClientMessage(i, COLOR5, string);
}
}
}
return 1;
}
Put this at the top of your script.
pawn Код:
#define FADE1 0xFFFFFFFF
#define FADE2 0xC8C8C8C8
#define FADE3 0xAAAAAAAA
#define FADE4 0x8C8C8C8C
#define FADE5 0x6E6E6E6E
pawn Код:
dcmd_engine(playerid, params[])
{
if(strcmp(params, "engine", true) == 0)
{
new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, message[43+MAX_PLAYER_NAME+1], playername[MAX_PLAYER_NAME+1];
vehicleid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, playername, sizeof(playername));
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.");
format(message, sizeof(message), "** %s has turned on the vehicle's ignition **", playername);
for (new i = 0; i != MAX_PLAYERS; ++i)
{
NearMessageSender(i, 8, message, FADE1, FADE2, FADE3, FADE4, FADE5);
}
}
}
return 1;
}
I didn't tested it.