[Tutorial] Labelґs
#1

Hello,
I decided to create an tutorial about labels.

I will start labels who just stand in a place and doenst do anything.

okay at the top of your script :

pawn Код:
new Text3D:label[MAX_PLAYERS];
pawn Код:
Create3DTextLabel("I'm at the coordinates:\nX, Y, Z", 0x008080FF, X, Y, Z, 40.0, 0, 0);
[url]http://wiki.sa-mp.com/wiki/Create3DTextLabel[/url]
that's just a label with names, if you want it on a player's head or on a vehicle you need:

This is to just attach is to a player.

pawn Код:
new Text3D:label = Create3DTextLabel("Hello, I am new here!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7); // X, Y , Z
pawn Код:
You can just make a command like
COMMAND:admintag(playerid,params[])
{
new Text3D:label = Create3DTextLabel("Hello, I am new here!", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7); // X, Y , Z
return 1; // just return 1;
}
if you want it attached to a vehicle you just do :

You need to add this at the top of your script :
pawn Код:
new Text3D:vehicle3Dtext[MAX_VEHICLES],vehicle_id;
than under ongamemodeinit :
pawn Код:
vehicle_id = CreateVehicle( 510, 0.0. 0.0, 15.0, 5, 0, 120 );
    vehicle3Dtext[ vehicle_id ] = Create3DTextLabel( "Example Text", 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
    //Creating the Vehicle
    //Attaching Text Label To Vehicle
    Attach3DTextLabelToVehicle( vehicle3Dtext[ vehicle_id ] , vehicle_id, 0.0, 0.0, 2.0);
[/pawn]
and for the vehicle label you need to place this under ongamemodeexit :
pawn Код:
Delete3DTextLabel( vehicle3Dtext[ vehicle_id ] );
return true;
Now I show it how to make a label above admin/vip's name like

Administrator NAME
Bronze VIP Name.

Add this at the top of you're script
pawn Код:
new Text3D:label[MAX_PLAYERS];
Add this under ongamemodeinit :
Change
pawn Код:
playerInfo[playerid][pAdminLevel])
to you're own maby get it from a kick command and you see if playervariables ... copy that and paste here.

so stock hereyouownvariable(playerid)

pawn Код:
stock AdminLevelToName(playerid)
{
    new admin[128];
    switch(playerInfo[playerid][pAdminLevel])
    {

        case 1:
        {
            admin = "Junior Administrator";
        }
        case 2:
        {
            admin = "Senior Administrator";
        }
        case 3:
        {
            admin = "Head Administrator";
        }
        case 4:
        {
            admin = "Community Advisor";
        }
        case 5:
        {
            admin = "Elite Administrators";
        }
        case 1337:
        {
            admin = "Server Co-Owner";
        }
        case 1338:
        {
            admin = "Server Owner";
        }
    }
    return admin;
}
You can also make this for VIP's.
The cases means the Admin level the player is.

And now the command.

pawn Код:
COMMAND:admintag(playerid,params[])
{
new string[128];
format(string, sizeof(string), "%s %s \n "EMBED_WHITE" ..-rp Administrator.", AdminLevelToName(playerid), szPlayerName); // creates the string
label[playerid] = Create3DTextLabel(string, COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0, 0); // create's the 3d label
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7); // labels attaches it.
return 1;
}
This is my first interview don't be that angry if I did something wrong.
I hope you guys learned something about strings.
Reply
#2

What did you explain ?
Reply
#3

Do something about your English, man. You're = You are. Your = possession.
And yeah, you didn't really explain anything.
Reply
#4

Nice Tutorial
Reply
#5

Pawno show me the errlor line.
Reply
#6

That error has nothing to do with this tutorial.
This tutorial doesn't explain anything, it just says "put this thing here and put this another one over there".
Reply
#7

You explain something,no "add it here".
Reply
#8

cool, but u can explain it better plus you have many grammar mistakes..
Reply
#9

♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦ ♦♦♦♦♦♦♦♦♦♦♦
Reply
#10

How to delete the player label
Reply
#11

Quote:
Originally Posted by fireranger11
View Post
How to delete the player label
Code:
Delete3DTextLabel( label[ playerid ] );
Delete3DTextLabel = Built-in function for text labels

label[playerid] = variable/data assigned for the creation of the text label


AWESOME JOB FOR BUMPING A 5-YEAR-OLD THREAD

****** IS THERE FOR A REASON

GUIDE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)