06.01.2013, 16:27
Hello, I am trying to fix my engine bug but it doesn't seem to wanna work, there's no errors on compile but when I type /engine it says "Unknown Command", this is what I have:
This is the code.
Also, the code below should display "Use (/engine) to toggle the vehicle engine." when entering a vehicle but that doesn't work either.
pawn Код:
CMD:engine(playerid, params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid, string[128];
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR:{FFFFFF} You need to login first before using any command.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR:{FFFFFF} You are not driving a vehicle.");
if(IsAPushBike(vehicleid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR:{FFFFFF} Bicycles have no engine.");
if(IsANormalCar(vehicleid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: {FFFFFF}You don't have the keys for this vehicle.");
if(IsPlayerInAnyVehicle(playerid) && !IsANormalCar(vehicleid))
{
if(engine > 0)
{
SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, 0, 0, objective);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{SetVehicleParamsEx(vehicleid, 0, 0, alarm, PlayerInfo[playerid][vLocked], 0, 0, objective);}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{SetVehicleParamsEx(vehicleid, 0, 0, alarm, PlayerInfo[playerid][vVLocked], 0, 0, objective);}
format(string, sizeof(string), "* %s has stopped the vehicle engine.", RPN(playerid));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
if(engine < 1)
{
GameTextForPlayer(playerid, "~g~Starting Engine..", 6000, 5);
SetTimerEx("EngineTimer", 6000, false, "i", playerid);
return 1;
}
}
return 1;
}
Also, the code below should display "Use (/engine) to toggle the vehicle engine." when entering a vehicle but that doesn't work either.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
{
new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(IsAPushBike(vehicleid))
{
SetVehicleParamsEx(vehicleid, 1, 0, alarm, doors, 0, 0, objective);
return 1;
}
if(!IsAPushBike(vehicleid))
{
SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, 0, 0, objective);
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}Use (/engine) to toggle the vehicle engine.");
return 1;
}
if(engine < 1 && IsANormalCar(vehicleid))
{
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}Use (/hotwire) to attempt to hotwire the vehicle.");
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}You must have a toolkit in order to hotwire.");
return 1;
}
if(!PlayerInfo[playerid][pCarLic])
{
if(!IsAPushBike(vehicleid))
{
if(!IsABike(vehicleid))
{
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}You don't have a drivers license.");
return 1;
}
}
}
if(!PlayerInfo[playerid][pBikeLic])
{
if (IsABike(vehicleid))
{
if(!IsAPushBike(vehicleid))
{
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}You don't have a motorbike license.");
return 1;
}
}
}
if(IsATowTruck(vehicleid))
{
SendClientMessage(playerid, COLOR_LIME, "VEHICLE INFORMATION: {FFFFFF}You can tow a vehicle using (/tow).");
return 1;
}
}
return 1;
}