SA-MP Forums Archive
doesnt attach 3dTextLabel to vehicle - 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)
+--- Thread: doesnt attach 3dTextLabel to vehicle (/showthread.php?tid=610958)



doesnt attach 3dTextLabel to vehicle - MayaEU - 30.06.2016

Hello, why does this command not place the 3d text label on the closest vehicle?

pawn Код:
if(strcmp(cmd, "/parkingticket", true) == 0)
    {
        new vehicleid=GetClosestCar(playerid);
        if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] != 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop!");
                return 1;
            }
            if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not on Duty!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /parkingticket [price] [reason]");
                return 1;
            }
            new price;
            price = strval(tmp);
            if(price < 1 || price > 1000) { SendClientMessage(playerid, COLOR_GREY, "   The parking ticket price can't be below 1 or higher than 1000."); return 1; }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /parkingticket [price] [reason]");
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetVehiclePos(vehicleid, x, y, z);
            format(string,sizeof(string),"Parking Ticket: Price: $%d Reason: %s", price, result);
            vehicle3Dtext[vehicleid] = Create3DTextLabel(string, TEAM_SAS_COLOR, x, y, z, 10, 0, 1);
            Attach3DTextLabelToVehicle(vehicle3Dtext[vehicleid], vehicleid, 0.0, -2.8, 0.0);
            CarInfo[vehicleid][cParkTicket] = 1;
            strmid(CarInfo[vehicleid][cPtText], result, 0, 64, 255);
            format(string, sizeof(string), "* %s writes down a parking ticket, and places it on the %s's windshield wiper.", RemoveUnderScore(playerid),vehName[GetVehicleModel(vehicleid)-400]);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 1;
        }
        return 1;
    }



Re: doesnt attach 3dTextLabel to vehicle - MayaEU - 30.06.2016

i will rep+


Re: doesnt attach 3dTextLabel to vehicle - Sew_Sumi - 30.06.2016

24 hour bumps only.


And is this
PHP код:
format(stringsizeof(string), "* %s writes down a parking ticket, and places it on the %s's windshield wiper."RemoveUnderScore(playerid),vehName[GetVehicleModel(vehicleid)-400]); 
part of the code working?

Does it ID the "nearest vehicle", or is it returning nothing, or random models?


Re: doesnt attach 3dTextLabel to vehicle - MayaEU - 30.06.2016

its chosing the closest vehicle and it says that the ticket has been placed, but it just doesnt place the 3dtextlabel


Re: doesnt attach 3dTextLabel to vehicle - Sew_Sumi - 30.06.2016

Are you using incognitos streamer elsewhere?


Re: doesnt attach 3dTextLabel to vehicle - MayaEU - 01.07.2016

Nope


Re: doesnt attach 3dTextLabel to vehicle - Sew_Sumi - 01.07.2016

PHP код:
vehicle3Dtext[vehicleid] = Create3DTextLabel(stringTEAM_SAS_COLORxyz1000); 
Try that, if it works, it's the Line of Sight option in the 3DText.


Re: doesnt attach 3dTextLabel to vehicle - MayaEU - 01.07.2016

also, isnt that line exact the same as the one im using already


Re: doesnt attach 3dTextLabel to vehicle - MayaEU - 01.07.2016

Nope, its still now showing any label


Re: doesnt attach 3dTextLabel to vehicle - Jingles - 01.07.2016

You can always use Incognito's streamer:

vehicle3Dtext[vehicleid] = CreateDynamic3DTextLabel(string, TEAM_SAS_COLOR, x, y, z, 10, .attachedvehicle = vehicleid, .testlos = 1);