Scripting problem [help with attach3DTextLabelToPlayer]
#1

I have made this little filterscript so that i can have ''World Wide Roleplay Server Owner'' above my players head for others to see. It works fine but i just recently found out that one other player(not sure if any other players have it but its usually only one) in the server [usually ID 4] has the text above there head aswell. How can i make it so it only shows above my head?


This is what ive used so far:

Код HTML:
public OnPlayerCommandText(playerid, cmdtext[])

	if (strcmp("/soj2968", cmdtext, true, 10) == 0)
{
    new Text3D:label = Create3DTextLabel("World Wide Roleplay Server Owner", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.5);
    return 1;
}
EDIT: where can i get these color codes(0x008080FF) ? The only ones i can find are in this format(#FF0000) which for some reason dont change the message color in pawn.
Reply
#2

thats because you havn't defined that only you can do the command, at the moment anyone who does the command can have it on there head

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   
    if (strcmp("/soj2968", cmdtext, true, 10) == 0)
{
    new PlayerName[24]; // We create a variable which will contain the players name.
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName,"your name here",true)) // We use strcmp to check if the player who entered the car is the same as ''
     {
    new Text3D:label = Create3DTextLabel("World Wide Roleplay Server Owner", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.5);
}
    return 1;
}
havnt tested this but use somthing along the lines of this
Reply
#3

Quote:
Originally Posted by (*|Flake|*)
Посмотреть сообщение
thats because you havn't defined that only you can do the command, at the moment anyone who does the command can have it on there head

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   
    if (strcmp("/soj2968", cmdtext, true, 10) == 0)
{
    new PlayerName[24]; // We create a variable which will contain the players name.
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName,"your name here",true)) // We use strcmp to check if the player who entered the car is the same as ''
     {
    new Text3D:label = Create3DTextLabel("World Wide Roleplay Server Owner", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.5);
}
    return 1;
}
havnt tested this but use somthing along the lines of this
i think the parameter size in strcmp should be ignored or set to the same size? like
pawn Код:
if(strcmp("/soj2968",cmdtext,true) == 0)
or maybe simply like
pawn Код:
if(!strcmp("/soj2968",cmdtext,true))
btw for the color codes, see https://sampwiki.blast.hk/wiki/Hex and https://sampwiki.blast.hk/wiki/Colors_Li...d_player_color
and the color is not changed in pawn but in game :P
also i think you can't see your own 3D Text Label (attached with Attach3DTextLabelToPlayer), it may only visible for other player(s).
Reply
#4

Thanks No one done the command though, only i type it and it comes up above another player aswell. Plus do you know how i can make a command to turn it off?

Thanks heaps for you help man
Reply
#5

To convert #FFFFFF to use in pawn, add 0x to the front and FF to the end.

0xFFFFFFFF
Reply
#6

Thanks guys, im not sure which ones right because im getting errors now
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)