This command isnt doing what its suppose to be doing
#8

Try this boot command (trunk)

pawn Код:
CMD:trunk(playerid, params[])
{
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new oldcar = gLastCar[playerid];
    new Float:cX, Float:cY, Float:cZ;
    GetVehicleParamsEx(oldcar, engine, lights, alarm, doors, bonnet, boot, objective);
    GetVehiclePos(oldcar, cX, cY, cZ);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(!IsAPlane(vehicleid) || !IsAHelicopter(vehicleid) || !IsABike(vehicleid) || !IsATrain(vehicleid) || !IsABoat(vehicleid))
    {
        if(IsPlayerDriver(playerid) || IsPlayerInRangeOfPoint(playerid, 5, cX+2, cY, cZ))
                {
                    if(boot != 1)
                    {
                        boot = 1;
                        SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
                        SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've opened the trunk!");
                        format(string, sizeof(string), "* %s opens up the trunk of the car.", sendername);
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else
                    {
                        boot = 0;
                        SetVehicleParamsEx(oldcar,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
                        SendClientMessage(playerid, 0xFFFFFFAA, "[Vehicle Control] You've shut the trunk!");
                        format(string, sizeof(string), "* %s closes the trunk of the car.", sendername);
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
            }
        }
    return boot;
}


stock IsPlayerDriver(playerid)
{
    if(IsPlayerConnected(playerid) && GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
    {
        return 1;
    }
    return 0;
}
Works for me, hopefully works for you too.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)