Texto..
#1

How can I store the text that make with the command to be able to take it to another callback ?

pawn Код:
dcmd_announce(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 1)
{
new dmajust[512];
if(!strlen(params)) return SendClientMessage(playerid, ROJO, "[Uso]; /announce <texto>");

format(dmajust,sizeof(dmajust),"~w~]~w~]~w~] %s ~w~]~w~]~w~]",params);
TextDrawSetString(Anuncio, dmajust),SetTimer("TextdrawAnuncio", 200, 0);

return TextDrawShowForPlayer(playerid, Anuncio);
}
else return SendClientMessage(playerid,ROJO, "[ERROR]: Necesitas ser administrador para poder usar este comando.");
}
Reply
#2

You have to create a variable to store the texts in (in the beginning of your gamemode):
pawn Код:
new PlayerTexts[MAX_PLAYERS][512]; // 512 is pretty big, I based it on the size of your dmajust variable. Consider to make both smaller
Then store the text in the variable you just created (in your CMD):
pawn Код:
dcmd_announce(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 1)
    {
        new dmajust[512];
        if(!strlen(params)) return SendClientMessage(playerid, ROJO, "[Uso]; /announce <texto>");

        format(dmajust,sizeof(dmajust),"~w~]~w~]~w~] %s ~w~]~w~]~w~]",params);
        TextDrawSetString(Anuncio, dmajust),SetTimer("TextdrawAnuncio", 200, 0);

        format(PlayerTexts[playerid], sizeof(PlayerTexts[playerid]), "%s", params);

        return TextDrawShowForPlayer(playerid, Anuncio);
    }
    else return SendClientMessage(playerid,ROJO, "[ERROR]: Necesitas ser administrador para poder usar este comando.");
}
Now you can get the text anywhere in your script using:
pawn Код:
PlayerTexts[playerid]
Reply
#3

It gave me the error variable but the change and worked for me as well:

pawn Код:
new PlayerTexts[256];
pawn Код:
dcmd_announce(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 1)
{
new dmajust[256];
if(!strlen(params)) return SendClientMessage(playerid, ROJO, "[Uso]; /announce <texto>");

format(dmajust,sizeof(dmajust),"~w~]~w~]~w~] %s ~w~]~w~]~w~]",params);
TextDrawSetString(Anuncio, dmajust),SetTimer("TextdrawAnuncio", 200, 0);

format(PlayerTexts, sizeof(PlayerTexts), "%s", params);

return TextDrawShowForPlayer(playerid, Anuncio);
}
else return SendClientMessage(playerid,ROJO, "[ERROR]: Necesitas ser administrador para poder usar este comando.");
}
pawn Код:
forward TextdrawAnuncio5(playerid);

public TextdrawAnuncio5(playerid)
{
format(stringo,sizeof(stringo),"~w~]~w~]~w~] %s ~w~]~w~]~y~]",PlayerTexts);
TextDrawSetString(Anuncio, stringo),SetTimer("TextdrawAnuncio", 250, 0);
return 1;
}
Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)