Texto.. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Texto.. (
/showthread.php?tid=508634)
Texto.. -
Snoopythekill - 23.04.2014
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.");
}
Re: Texto.. -
Conradus - 23.04.2014
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:
Respuesta: Texto.. -
Snoopythekill - 23.04.2014
It gave me the error variable but the change and worked for me as well:
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