format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ...");
CMD:motor(playerid, params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
new vehicleid = GetPlayerVehicleID(playerid);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Necesitas estar logueado para usar el comando.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Usted no estб en un coche.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Las bicicletas no necesitan motor.");
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!engine)
{
format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ...");
SetVehicleParamsEx(vehicleid, 1, 1, 1, 1, 1, 1, 1);
}
else
{
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vLocked], bonnet, boot, objective);}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{SetVehicleParamsEx(vehicleid, 0, lights, alarm, PlayerInfo[playerid][vVLocked], bonnet, boot, objective);}
format(string, sizeof(string), "* %s gira la llave y apaga el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
return 1;
}
SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective); //Prendido
SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective); //Apagado
CMD:motor(playerid, params[])
{
static vehicleid = GetPlayerVehicleID(playerid);
static engine, lights, alarm, doors, bonnet, boot, objective, string[128];
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Necesitas estar logueado para usar el comando.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Usted no estб en un coche.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Las bicicletas no necesitan motor.");
switch(engine)
{
case 0:
{
format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ...");
SetVehicleParamsEx(vehicleid, 1, lights, alarm, 1, bonnet, boot, objective);
}
case 1:
{
format(string, sizeof(string), "* %s gira la llave y apaga el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, 0, bonnet, boot, objective);
}
}
return 1;
}
stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:ix, Float:iy, Float:iz;
new Float:cx, Float:cy, Float:cz;
foreach(Player, i)
{
if(IsPlayerLoggedIn(i))
{
if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
GetPlayerPos(i, ix, iy, iz);
cx = (x - ix);
cy = (y - iy);
cz = (z - iz);
if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
{
SendClientMessage(i, col1, string);
}
else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
{
SendClientMessage(i, col2, string);
}
else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
{
SendClientMessage(i, col3, string);
}
else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
{
SendClientMessage(i, col4, string);
}
else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
{
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}
static vehicleid = GetPlayerVehicleID(playerid);
Acб estб el code
pawn Код:
pawn Код:
|
stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:ix, Float:iy, Float:iz;
new Float:cx, Float:cy, Float:cz;
foreach(Player, i)
{
if(IsPlayerLoggedIn(i) && IsPlayerLoggedIn(playerid)) // <----------
{
if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
GetPlayerPos(i, ix, iy, iz);
cx = (x - ix);
cy = (y - iy);
cz = (z - iz);
if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
{
SendClientMessage(i, col1, string);
}
else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
{
SendClientMessage(i, col2, string);
}
else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
{
SendClientMessage(i, col3, string);
}
else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
{
SendClientMessage(i, col4, string);
}
else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
{
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}
stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:ix, Float:iy, Float:iz;
new Float:cx, Float:cy, Float:cz;
foreach(Player, i)
{
if(IsPlayerLoggedIn(i))
{
if(GetPlayerInterior(i) == GetPlayerInterior(playerid) && GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid))
{
GetPlayerPos(i, ix, iy, iz);
cx = (x - ix); cy = (y - iy); cz = (z - iz);
if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16))) {
SendClientMessage(i, col1, string);
}
else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8))) {
SendClientMessage(i, col2, string);
}
else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4))) {
SendClientMessage(i, col3, string);
}
else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2))) {
SendClientMessage(i, col4, string);
}
else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius))) {
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
CMD:motor(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
static engine, lights, alarm, doors, bonnet, boot, objective, string[128];
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Necesitas estar logueado para usar el comando.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Usted no estб en un coche.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Las bicicletas no necesitan motor.");
switch(engine)
{
case 0:
{
format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ..."); //<----------
SetVehicleParamsEx(vehicleid, 1, lights, alarm, 1, bonnet, boot, objective);
}
case 1:
{
format(string, sizeof(string), "* %s gira la llave y apaga el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); //<--------------
SetVehicleParamsEx(vehicleid, 0, lights, alarm, 0, bonnet, boot, objective);
}
}
return 1;
}
CMD:motor(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Necesitas estar logueado para usar el comando.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Usted no estб en un coche.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Las bicicletas no necesitan motor.");
switch(engine)
{
case -1, 0:
{
format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ..."); //<----------
SetVehicleParamsEx(vehicleid, 1, lights, alarm, 1, bonnet, boot, objective);
}
case 1:
{
format(string, sizeof(string), "* %s gira la llave y apaga el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); //<--------------
SetVehicleParamsEx(vehicleid, 0, lights, alarm, 0, bonnet, boot, objective);
}
}
return 1;
}
CMD:motor(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Necesitas estar logueado para usar el comando.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "Usted no estб en un coche.");
if(vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, COLOR_GREY, "Las bicicletas no necesitan motor.");
switch(engine)
{
case VEHICLE_PARAMS_OFF:
{
format(string, sizeof(string), "* %s gira la llave y enciende el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SendClientMessage(playerid, COLOR_WHITE, "El motor se encendiу ..."); //<----------
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
}
case VEHICLE_PARAMS_ON:
{
format(string, sizeof(string), "* %s gira la llave y apaga el motor.", RPN(playerid));
SendNearbyMessage(playerid, 15.0, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); //<--------------
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
}
}
return 1;
}