Код:
CMD:lights(playerid, params[])
{
if(auth[playerid] == 0){ return Kick(playerid); }
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(lights == 0){
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
}
else if(lights == 1){
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
}
}
else return SendClientMessage(playerid, -1, "{B2BEB5}Only the driver of the vehicle can use this command.");
}
else return SendClientMessage(playerid, -1, "{B2BEB5}You are not in a vehicle.");
return 1;
}
CMD:alarm(playerid, params[])
{
if(auth[playerid] == 0){ return Kick(playerid); }
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(alarm == 0){
SetVehicleParamsEx(vehicleid, engine, lights, 1, doors, bonnet, boot, objective);
}
else if(alarm == 1){
SetVehicleParamsEx(vehicleid, engine, lights, 0, doors, bonnet, boot, objective);
}
}
else return SendClientMessage(playerid, -1, "{B2BEB5}Only the driver of the vehicle can use this command.");
}
else return SendClientMessage(playerid, -1, "{B2BEB5}You are not in a vehicle.");
return 1;
}
CMD:bonnet(playerid, params[])
{
if(auth[playerid] == 0){ return Kick(playerid); }
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(bonnet == 0){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
}
else if(bonnet == 1){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
}
}
else return SendClientMessage(playerid, -1, "{B2BEB5}Only the driver of the vehicle can use this command.");
}
else return SendClientMessage(playerid, -1, "{B2BEB5}You are not in a vehicle.");
return 1;
}
CMD:boot(playerid, params[])
{
if(auth[playerid] == 0){ return Kick(playerid); }
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(boot == 0){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
}
else if(boot == 1){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
}
}
else return SendClientMessage(playerid, -1, "{B2BEB5}Only the driver of the vehicle can use this command.");
}
else return SendClientMessage(playerid, -1, "{B2BEB5}You are not in a vehicle.");
return 1;
}
CMD:lock(playerid, params[])
{
if(auth[playerid] == 0){ return Kick(playerid); }
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(doors == 0){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
SendClientMessage(playerid, -1, "{77DD77}Your vehicle doors have been {FF6961}locked{77DD77}.");
}
else if(doors == 1){
SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
SendClientMessage(playerid, -1, "{77DD77}Your vehicle doors have been {006600}unlocked{77DD77}.");
}
}
else return SendClientMessage(playerid, -1, "{B2BEB5}Only the driver of the vehicle can use this command.");
}
else return SendClientMessage(playerid, -1, "{B2BEB5}You are not in a vehicle.");
return 1;
}
They all seem fine to me. But i have some tips...
1- Make sure that the vehicle has lights, doors, bonnet, and a boot.
2- Make sure its night, since lights only work at night.
3- Look for any hooks in your includes/gamemode for SetVehicleParamsEx & GetVehicleParamsEx and check if its calling the main function within.
Late already, look above.. :/