SA-MP Forums Archive
What's the problem here? - 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: What's the problem here? (/showthread.php?tid=659259)



What's the problem here? - SaMuRy - 28.09.2018

Quote:

if (!strcmp(cmd,"/PCar",true))
{
if(userdata[playerid][usercop] == 1) return SendClientMessage(playerid,COLOR_KRED,"You're not an officer !");
if(IsCop[playerid] == 0) return SendClientMessage(playerid,COLOR_KRED,"You're not available!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /PoliceCar [LSPD]/[Ranger]/[FBI]/[Turismo]/[Cheetah]");
new Float:X,Float:Y,Float:Z,Float:Angle;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
if(!strcmp(tmp, "LSPD", true))
{
new freetempid = getfreetempcarid();
if(userdata[playerid][usercop] == 0) return SendClientMessage(playerid, COLOR_KRED, "!аъд ма щеиш");
tempCars[freetempid][tempcarid] = CreateVehicle(596,X,Y,Z,Angle,1,-1,-1);
tempCars[freetempid][taken] = 1;
Test[playerid] = Create3DTextLabel("Pizza Driver", 0x00C7FFFF, X, Y, Z, 40.0, 0);
Attach3DTextLabelToPlayer(Test[playerid], playerid, X, Y, Z);
RemovePlayerFromVehicle(playerid);
PutPlayerInVehicle(playerid,tempCars[freetempid][tempcarid],0);
format(String,sizeof(String),"(LSPD Police) You've teleport LSPD Vehicle");
SendClientMessage(playerid,-1,String);
SendClientMessage(playerid,Daniel,"/CFIX - мъйчеп дшлб");
SendClientMessage(playerid,Daniel,"/CNos - мдесфъ рйише");
return 1;
}

Test[playerid] = Create3DTextLabel("Pizza Driver", 0x00C7FFFF, X, Y, Z, 40.0, 0);
Attach3DTextLabelToPlayer(Test[playerid], playerid, X, Y, Z); -- Nothing happend... No errors / Warnings.


Re: What's the problem here? - NaS - 28.09.2018

X, Y, Z in Attach3DTextLabelToPlayer are offsets.

You use the position as offsets, for example 1920.0, 232.3, 12.4.

If you do this, the label will be about 2000 meters away from the target player.
Use 0.0, 0.0, 1.0 or so for the offset, not the position.

Also make sure you test this with another player. You cannot see labels that are attached to yourself.

Furthermore, why a new thread? You just opened another with the same problem.


Re: What's the problem here? - SaMuRy - 28.09.2018

Quote:
Originally Posted by NaS
Посмотреть сообщение
X, Y, Z in Attach3DTextLabelToPlayer are offsets.

You use the position as offsets, for example 1920.0, 232.3, 12.4.

If you do this, the label will be about 2000 meters away from the target player.
Use 0.0, 0.0, 1.0 or so for the offset, not the position.

Also make sure you test this with another player. You cannot see labels that are attached to yourself.

Furthermore, why a new thread? You just opened another with the same problem.
Sorry for the new thread btw.
And I've fixed it but I am using # SandBox, Can i see a textlabel if the player is afk?
cause if yes it still doesn't work.


Re: What's the problem here? - Undef1ned - 28.09.2018

Yes, even if the player is afk, you can still see the text label.