PHP код:
CMD:criarlabel(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] != true) return SendClientMessage(playerid, -1, "{FF0000}| {33AA33}ERRO {FF0000}| {FFFFFF}Vocк nгo estб logado!");
// Setup local variables
new Float:x,
Float:y,
Float:z,
file[100],
File:PFile,
LineForFile[100],
Msg[128],
Distancia,
FRASE[50];
if (APlayerData[playerid][PlayerJailed] != 0) return SendClientMessage(playerid, COR_ERRO, "{FF0000}| {33AA33}ERRO {FF0000}| {FFFFFF}Vocк nгo pode usar esse comando na cadeia!");
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if(CallRemoteFunction("PegarLevelNovo","i",playerid) < 7) return SendClientMessage(playerid, -1, "{FF0000}| {33AA33}ERRO {FF0000}| {FFFFFF}Vocк nгo tem permissгo para isso!");
if (sscanf(params, "ui", FRASE, Distancia)) SendClientMessage(playerid, 0xFF0000AA, "{FF0000}| {33AA33}INFO {FF0000}| {FFFFFF}Use: \"/criarlabel [Texto] [Distancia]\"");
else
{
GetPlayerPos(playerid, x, y, z);
z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)
// Move the player a bit, otherwise he could get stuck inside the camera-object
// Save the camera to a file
for (new LABELID; LABELID < MAX_LABEL; LABELID++)
{
// Check if this index is free
// Setup this label (create the labels and store the data)
Create3DTextLabel(FRASE, 0xFF0000AA, x, y, z, Distancia, 0, 0);
// Save the file
format(file, sizeof(file), LABELFile, LABELID); // Construct the complete filename for this camera-file
PFile = fopen(file, io_write); // Open the label-file for writing
format(LineForFile, 100, "Create3DTextLabel(%s, 0xFF0000AA, %i, %i, %i, %i, 0, 0)", FRASE, x, y, z, Distancia);
fwrite(PFile, LineForFile); // And save it to the file
fclose(PFile); // Close the file
// Let the player know he created a new camera
format(Msg, 128, "{FF0000}| {33AA33}LABEL {FF0000}| {FFFFFF}Vocк criou o label ID: %i", LABELID);
SendClientMessage(playerid, 0x00FF00FF, Msg);
// Exit the function
return 1;
}
// In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
format(Msg, 128, "{FF0000}| {33AA33}LABEL {FF0000}| {FFFFFF}Vocк nгo pode criar mais de %s labels", MAX_LABEL);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
return 0;
return 1;
}