28.09.2012, 05:13
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 :
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.
if you want it attached to a vehicle you just do :
You need to add this at the top of your script :
than under ongamemodeinit :
[/pawn]
and for the vehicle label you need to place this under ongamemodeexit :
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
Add this under ongamemodeinit :
Change
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)
You can also make this for VIP's.
The cases means the Admin level the player is.
And now the command.
This is my first interview don't be that angry if I did something wrong.
I hope you guys learned something about strings.
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]
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;
}
You need to add this at the top of your script :
pawn Код:
new Text3D:vehicle3Dtext[MAX_VEHICLES],vehicle_id;
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);
and for the vehicle label you need to place this under ongamemodeexit :
pawn Код:
Delete3DTextLabel( vehicle3Dtext[ vehicle_id ] );
return true;
Administrator NAME
Bronze VIP Name.
Add this at the top of you're script
pawn Код:
new Text3D:label[MAX_PLAYERS];
Change
pawn Код:
playerInfo[playerid][pAdminLevel])
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;
}
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;
}
I hope you guys learned something about strings.