12.01.2015, 13:10
Hello guys, i'm having a few problems finding a way to make /e works for faction cars
Here is the enum of the cars
Can you guys suggest a way to edit the /e command and make it able to /e if PlayerInfo[playerid][Faction] = Cars[vehicleid][CarGroup]??
PHP код:
CMD:e(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new lights, alarm, doors, bonnet, boot, objective,string[256];
if(vehicleid != INVALID_VEHICLE_ID)
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, GREY, "You must be in a vehicle before you can do this!");
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, GREY, "Only the driver can do this!");
if(PlayerInfo[playerid][OwnedCarID] == vehicleid)
{
if(Cars[vehicleid][CarEngine] == 0)
{
format(string, sizeof(string), "* %s has started the vehicles engine.", RemoveUnderLine(name));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
Cars[vehicleid][CarEngine] = 1;
}
else if(Cars[vehicleid][CarEngine] == 1)
{
format(string, sizeof(string), "* %s has stopped the vehicles engine.", RemoveUnderLine(name));
NearByMessage(playerid, PURPLE, string);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Cars[vehicleid][CarEngine] = 0;
}
}
if(PlayerInfo[playerid][OwnedCarID] != vehicleid)
{
SendClientMessage(playerid, GREY, "You don't have keys for this vehicle.");
}
return 1;
}
PHP код:
enum Vehicles
{
CarModel,
CarColour1,
CarColour2,
CarNos,
CarGroup,
CarEngine,
CarLock,
Float: CarPosX,
Float: CarPosY,
Float: CarPosZ,
Float: CarZAngle,
GameID,
};
new Cars[MAX_VEHICLES][Vehicles];