SA-MP Forums Archive
Another Thing! - 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: Another Thing! (/showthread.php?tid=378387)



Another Thing! - RyanPetersons - 17.09.2012

I need a help about formats.
pawn Код:
if(pInfo[playerid][ach1] == 1)
    {
    format(string,1000,"{00FF00}First Cigarette",acheivement());
    }
    if(pInfo[playerid][ach1] == 0)
    {
    format(string,1000,"{FFFFFF}First Cigarette",acheivement());
    }
    ShowPlayerDialog(playerid,92728,DIALOG_STYLE_LIST,"Acheivements",string,"OK","");
    }
I want to make more formats like this, that appears in the dialog, can you tell me how to adjust many formats with same string in a dialog?
Pleaze help me with it..


Re: Another Thing! - AtItsMax - 17.09.2012

pawn Код:
if(pInfo[playerid][ach1] == 1)
    {
    format(string,sizeof(string),"{00FF00}First Cigarette",acheivement());
     ShowPlayerDialog(playerid,92728,DIALOG_STYLE_LIST,"Acheivements",string,"OK","");
    }
    if(pInfo[playerid][ach1] == 0)
    {
    format(string,sizeof(string),"{FFFFFF}First Cigarette",acheivement());
    ShowPlayerDialog(playerid,92728,DIALOG_STYLE_LIST,"Acheivements",string,"OK","");
    }
Now what's wrong with it?
Or you can also use "strcat" for string formatting since formatting using format function is very bad and i do not recommend it.


Re: Another Thing! - ViniBorn - 17.09.2012

Show the function 'acheivement'


Re: Another Thing! - RyanPetersons - 17.09.2012

Nothing, is wrong, I mean to say that
pawn Код:
if(pInfo[playerid][ach1] == 1)
    {
    format(string,1000,"{00FF00}First Cigarette",acheivement());
    }
    if(pInfo[playerid][ach1] == 0)
    {
    format(string,1000,"{FFFFFF}First Cigarette",acheivement());
    }
    if(pInfo[playerid][ach2] == 1)
    {
    format(string,1000,"{FFFFFF}First Vehicle",acheivement());
    }
if(pInfo[playerid][ach2] == 0)
    {
    format(string,1000,"{FFFFFF}First Vehicle",acheivement());
    }
    ShowPlayerDialog(playerid,92728,DIALOG_STYLE_LIST,"Acheivements",string,"OK","");
    }
I wrote that full code but the only text appear in the dialog is "First Cigarette", it doesnt appear "First Vehicle".
That is the problem.


Re: Another Thing! - RyanPetersons - 17.09.2012

pawn Код:
stock acheivement()
{
new string2[140];
if(pInfo[playerid][ach2] == 1)
{
format(string2,sizeof(string2),"{00FF00}FirstMan");
}
if(pInfo[playerid][ach2] == 0)
{
format(string2,sizeof(string2),"{FFFFFF}FirstMan");
}
return 1;
}



Re: Another Thing! - ViniBorn - 17.09.2012

Your code is very confusing ...
pawn Код:
if(pInfo[playerid][ach1] == 1)
    format(string,256,"%s\n {00FF00}First Cigarette",string);
if(pInfo[playerid][ach1] == 0)
    format(string,256,"%s\n {FFFFFF}First Cigarette",string);
if(pInfo[playerid][ach2] == 1)
    format(string,256,"%s\n {FFFFFF}First Vehicle",string);
if(pInfo[playerid][ach2] == 0)
    format(string,256,"%s\n {FFFFFF}First Vehicle",string);

ShowPlayerDialog(playerid,92728,DIALOG_STYLE_LIST,"Acheivements",string,"OK","");

acheivement()
{
    new string2[20];
    if(pInfo[playerid][ach2] == 0)
        format(string2,sizeof(string2),"{FFFFFF}FirstMan");
    if(pInfo[playerid][ach2] == 1)
        format(string2,sizeof(string2),"{00FF00}FirstMan");

    return string2;
}