SA-MP Forums Archive
Words in variable. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Words in variable. (/showthread.php?tid=119096)



Words in variable. - Martin_M - 06.01.2010

Hey, guys. I'm creating E-mail system using GUI. It's uses 2 dialog's, one of them is for message, other one for the receiver. I want to save the message into variable, and then, after i put receiver name, i want to send him that message.
Is it possible to make it in other way, without .ini files?


Re: Words in variable. - Correlli - 06.01.2010

pawn Код:
new
    myArray[12];
myArray = "message";
pawn Код:
new
    myArray[12];
format(myArray, sizeof(myArray), "message");
Or do it like this if you want to use it per player:
pawn Код:
new
    myArray[MAX_PLAYERS][12];
myArray[playerid] = "message";
pawn Код:
new
    myArray[MAX_PLAYERS][12];
format(myArray[playerid], sizeof(myArray), "message");



Re: Words in variable. - Martin_M - 06.01.2010

Thanks. But i think it didn't work.
Look, i make you a little example.

Код:
if(dialogid == 1) // To write sentence.
{
if(!response)
{
// Clearing up variable
return 1;
}
if(response)
{
MyVariable[playerid] = strlen(inputtext);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUTE,"E-mail","Write receiver","Send","Go back");
return 1;
}
}

if(dialogid == 2) // Write receiver and send message.
{
if(!response)
{
// Clearing up variable
return 1;
}
if(response)
{
SendClientMessage(receiverid,COLOR,"You have E-mail");
SendClientMessage(receiverid,COLOR,MyVariable[playerid]);
return 1;
}
}
I want something like this. :>


Re: Words in variable. - cmg4life - 06.01.2010

(You need to create a string OR) just new bla[MAX_PLAYERS][256]; then somewhere before using it format(bla[playerid], 256, "BlaBlaBla"); and then do SendClientMessage... i think it's the best way (except the 256, try to make the size as small as possible).