[FilterScript] [N]Labels ! Crea Labels In-Game (Guardado & Cargado Solo)
#1

Creador de Labels In-Game!


Buenas, este script lo venia pensando hace bastante, lo tengo hace bastante, nunca lo pude lanzar, ya que contaba con bugs, o no sabia como cargar de txt, lo cual aprendi y me ayudaron, bastante xdd. Espero que les sea Util.


Que Consiste este FS ?

Consiste en crear labels in-game, los labels se crean en un .txt en scriptfiles, y cuando cargas el FS, ya se colocan in-game solos !


Que nesesito ?:
ZCMD by Zeex.
Sscanf by ******.
Streamer by Incognito.



Comandos:


/Agregar3d [Descripciуn]


pawn Код:
#include <a_samp>
#include <sscanf2>
#include <streamer>
#include <zcmd>
#define Nombre_De_TXT_Label         "Labels.txt"

public OnFilterScriptInit()
{
       new Labels;
       Labels = AgregarLabels(Nombre_De_TXT_Label);
    new Linea[128];
    format(Linea, sizeof(Linea), "** %i Labels cargados **",Labels);
    printf(Linea);
    return 1;
}

public OnFilterScriptExit()
{
    DestroyAllDynamic3DTextLabels();
    return 1;
}


CMD:agregar3d(playerid, params[])
{
    new Msg[128]
        if(!IsPlayerAdmin(playerid)) return 0;
    new Float:X, Float:Y, Float:Z;
    if(unformat(params, "s[128]",params)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Uso : /Agregar3d [Descripcion]");
    GetPlayerPos(playerid, X, Y, Z);
    AgregarLabelsAtxt(Nombre_De_TXT_Label, params, X, Y, Z);
    CreateDynamic3DTextLabel(params, 0xFFFFFFFF, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
    format(Msg, sizeof(Msg), "Creaste un nuevo Label en tu posicion. Con el texto de \"%s\".",params);
    return SendClientMessage(playerid, 0xFFFF00FF, Msg);
}

stock AgregarLabels(ArchivoLabels[])
{
    if(!fexist(ArchivoLabels)) return 0;

    new File:ArchivoLab = fopen(ArchivoLabels, io_read),
    Linea[128],
    InformacionL[128],
    Float:LX,
    Float:LY,
    Float:LZ,
    CantidadLabels = 0;
    while(fread(ArchivoLab, Linea))
    {
        if(!unformat(Linea, "p<,>s[128]fff", InformacionL,LX,LY,LZ))
        {
            CreateDynamic3DTextLabel(InformacionL, 0xFFFFFFFF, LX, LY, LZ, 100.0);
            CantidadLabels++;
        }
    }

    fclose(ArchivoLab);
    return CantidadLabels;
}

stock AgregarLabelsAtxt(ArchivoLabels[], InformacionL[], Float:LX, Float:LY, Float:LZ)
{
    new File:ArchivoLab, Linea[128];
    format(Linea, sizeof(Linea), "%s,%.2f,%.2f,%.2f\r\n",InformacionL, LX, LY, LZ);
    ArchivoLab = fopen(ArchivoLabels, io_append);
    fwrite(ArchivoLab, Linea);
    fclose(ArchivoLab);
    return 1;
}
Le quisiera dar las gracias a ruben, que me enseсo a usar las funciones de archivos.

Espero que les sea util! Saludos!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)