SA-MP Forums Archive
Attach3DTextLabel Issue - 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: Attach3DTextLabel Issue (/showthread.php?tid=611103)



Attach3DTextLabel Issue - alexanderjb918 - 02.07.2016

Код:
COMMAND:carsign(playerid, params[])
{
    if(GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_WHITE, "You must be the driver in a vehicle to use this!");
    if(VehicleInfo[GetPlayerVehicleID(playerid)][vType] != VEHICLE_LSPD) return SendClientMessage(playerid, COLOR_WHITE, "You need to be in a police vehicle to use this.");
    if(GetPVarInt(playerid, "Delay") > GetCount()) return SendClientMessage(playerid, COLOR_LIGHTRED, "You must wait before performing this command!");
	new txt[50];
	if(sscanf(params, "s[50]", txt)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /carsign [text]");
	else
	{
	    if((GetPVarInt(playerid, "Member") == 1 && GetPVarInt(playerid, "Rank") >= 2) || GetPVarInt(playerid, "Member") == 2)
	    {
	        SetPVarInt(playerid, "Delay", GetCount()+2000);
	        new getcar = GetPlayerVehicleID(playerid);
			if(VehicleInfo[getcar][vUText] == 0) {
                VehicleInfo[getcar][vUText]=1;
                VehicleInfo[getcar][vCText] = Create3DTextLabel(txt, -1, 0.0, 0.0, 0.0, 50.0, 0, 1);
                Attach3DTextLabelToVehicle(VehicleInfo[getcar][vCText], getcar, -0.8, -2.8, -0.3);
                scm(playerid, -1, "Car sign added!");
            } else {
            VehicleInfo[getcar][vUText]=0;
            Delete3DTextLabel(VehicleInfo[getcar][vCText]);
			scm(playerid, -1, "Car sign removed!"); }
	    }
	    else SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command!");
	}
	return 1;
}
I've attempted to debug it and I have read the code multiple times and it seems like nothing wrong, basicly the label go's about 1 minute attached to the vehicle.


Re: Attach3DTextLabel Issue - SetPlayerNameTag - 02.07.2016

Same, but mine is label will be attached to other vehicles or even other scripted labels and disappear when a player connect


Re: Attach3DTextLabel Issue - alexanderjb918 - 02.07.2016

Because you are probably not attaching it to the vehicleid the players in..


Re: Attach3DTextLabel Issue - SetPlayerNameTag - 02.07.2016

No, I've re-made the D-RP's callsign script. it works fine now, the bug was from streamer.