SA-MP Forums Archive
GetVehicleTrailer not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetVehicleTrailer not working? (/showthread.php?tid=253433)



GetVehicleTrailer not working? - [MWR]Blood - 06.05.2011

My code:
pawn Код:
dcmd_work(playerid,params[])
    {
        new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(!IsWorkingVeh(playerid,pvehiclemodel)) return SendClientMessage(playerid,red,"ERROR: "lgrey"You need a "lyellow2"Truck"lgrey" or a "lyellow2"Van"lgrey" to make missions!");
        if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) && IsTruck(playerid,pvehiclemodel)) return SendClientMessage(playerid,red,"ERROR: "lgrey"You need to attach a "lyellow2"trailer "lgrey"to do missions!");
        if(IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: "lgrey"You are already in a mission! Please use "lyellow2"/cancelmission"lgrey" if you would like to cancel it!"); // prevents them from starting another mission
        new string[350];
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
        {
            if(GetVehicleTrailer(GetPlayerVehicleID(playerid)) == 435)
            {
            //workingvehicle[playerid] = GetPlayerVehicleID(playerid);
                new rand = random(sizeof(Trailer1Missions));
                CreatePlayerMission(playerid, Trailer1Missions[rand][UseTrailerCheck], Trailer1Missions[rand][MissionPay], Trailer1Missions[rand][loadx],Trailer1Missions[rand][loady], Trailer1Missions[rand][loadz], Trailer1Missions[rand][unloadx],Trailer1Missions[rand][unloady], Trailer1Missions[rand][unloadz]);
                format(string, sizeof(string), "MISSION: "lyellow2"%s", Trailer1Missions[rand][MissionName]);
                SendClientMessage(playerid,orange,string);
                print("checked");
            }
            if(GetVehicleTrailer(GetPlayerVehicleID(playerid)) == 450)
            {
                //workingvehicle[playerid] = GetPlayerVehicleID(playerid);
                new rand = random(sizeof(Trailer2Missions));
                CreatePlayerMission(playerid, Trailer2Missions[rand][UseTrailerCheck], Trailer2Missions[rand][MissionPay], Trailer2Missions[rand][loadx],Trailer2Missions[rand][loady], Trailer2Missions[rand][loadz], Trailer2Missions[rand][unloadx],Trailer2Missions[rand][unloady], Trailer2Missions[rand][unloadz]);
                format(string, sizeof(string), "MISSION: "lyellow2"%s", Trailer2Missions[rand][MissionName]);
                SendClientMessage(playerid,orange,string);
                print("checked");
            }
            if(GetVehicleTrailer(GetPlayerVehicleID(playerid)) == 584)
            {
                new rand = random(sizeof(Trailer4Missions));
                CreatePlayerMission(playerid, Trailer4Missions[rand][UseTrailerCheck], Trailer4Missions[rand][MissionPay], Trailer4Missions[rand][loadx],Trailer4Missions[rand][loady], Trailer4Missions[rand][loadz], Trailer4Missions[rand][unloadx],Trailer4Missions[rand][unloady], Trailer4Missions[rand][unloadz]);
                format(string, sizeof(string), "MISSION: "lyellow2"%s", Trailer4Missions[rand][MissionName]);
                SendClientMessage(playerid,orange,string);
                print("checked");
            }
            if(GetVehicleTrailer(GetPlayerVehicleID(playerid)) == 591)
            {
                new rand = random(sizeof(Trailer3Missions));
                CreatePlayerMission(playerid, Trailer3Missions[rand][UseTrailerCheck], Trailer3Missions[rand][MissionPay], Trailer3Missions[rand][loadx],Trailer3Missions[rand][loady], Trailer3Missions[rand][loadz], Trailer3Missions[rand][unloadx],Trailer3Missions[rand][unloady], Trailer3Missions[rand][unloadz]);
                format(string, sizeof(string), "MISSION: "lyellow2"%s", Trailer3Missions[rand][MissionName]);
                SendClientMessage(playerid,orange,string);
                print("checked");
            }
        }
        SendClientMessage(playerid,lightgreen,"*** Go to the red mark on the map to load!");
        IsPlayerInMission[playerid] = 1;
        return 1;
    }
But when I type /work, seems like it isn't getting the vehicle trailer or something, because nothing happens, it doesn't even print the "checked" in the console.
Any suggestions?


Re: GetVehicleTrailer not working? - [KO]KillerThriller - 06.05.2011

Quote:
At wiki
Gets the ID of the trailer attached to a vehicle.

Gets the ID of the trailer.
Not the model.