SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   error 037: invalid string (possibly non-terminated string) (https://forum.sa-mp.com/showthread.php?t=630371)

AnoTek 13/03/2017 01:54 PM

error 037: invalid string (possibly non-terminated string)
 
This is the command where is the error:
Code:

CMD:hqs(playerid, params[])
{
        if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi.");
        if(IsPlayerConnected(playerid))
        {
                if(CP[playerid] != 0) return SendClientMessage(playerid, COLOR_GOLD, "Ai deja un punct rosu activ. Foloseste comanda '/killcp' pentru a renunta la el.");
                {
                        ShowPlayerDialog(playerid, dGPS+3, DIALOG_STYLE_TABLIST_HEADERS, "HQ-uri", "Factiune\tTip\nLos Santos Police Departament\t{D2B48C}Departament\nSan Fierro Police Departament\t{D2B48C}Departament
                        \nLas Venturas Police Departament\t{D2B48C}Departament\nFederal Bureau of Investigation\t{FFA500}Departament\nNational Guard\t{FFA500}Departament\nMayor\t{FFA500}Mixt Faction\nParamedic\t{FFFFFF}Peaceful Faction
                        \nTow Truck Company\t{FFFFFF}Peaceful Faction\nNews Reporters\t{FFFFFF}Peaceful Faction\nHitman Agency\t{FFA500}Mixt Faction\nLos Santos School Instructors\t{D2B48C}Peaceful Faction\nLos Santos Taxi\t{FFFFFF}Peaceful Faction
                        \nSan Fierro School Instructors\t{FFFFFF}Peaceful Faction\nSan Fierro Taxi\t{FFFFFF}Peaceful Faction\nLas Venturas School Instructors\t{FFFFFF}Peaceful Faction\nLas Venturas Taxi\t{FFFFFF}Peaceful Faction\nGrove Street\t{FFFFFF}Gang
                        \nThe Ballas\t{FFFFFF}Gang\nLos Santos Vagos\t{FFFFFF}Gang\n69 Pier Mobs\t{FFFFFF}Gang\nSan Fierro Rifa\t{FFFFFF}Gang\nDa Nang Boys\t{FFFFFF}Gang\nThe Russian Bratva\t{FFFFFF}Gang\nYakuza\t{FFFFFF}Gang\nSindacco Family", "OK", "Cancel");
                       
                }
        }
        return 1;
}

How can i solve this

Flamehaze7 13/03/2017 01:58 PM

Re: error 037: invalid string (possibly non-terminated string)
 
Just do it in 1 line, don't create a new line for each \n you put, do it like this
Code:

"Hello\nthis text will be showed under Hello"

AnoTek 13/03/2017 02:04 PM

Re: error 037: invalid string (possibly non-terminated string)
 
error 075: input line too long (after substitutions)

Toroi 13/03/2017 02:07 PM

Re: error 037: invalid string (possibly non-terminated string)
 
Create a string and use strcat for matters like this one

http://wiki.sa-mp.com/wiki/Strcat

Flamehaze7 13/03/2017 02:08 PM

Re: error 037: invalid string (possibly non-terminated string)
 
Quote:

Originally Posted by AnoTek (Post 3854726)
error 075: input line too long (after substitutions)

Use strcat.

Example

Code:

stock HelpText
{
    new HelpTextz[1024];
    HelpTextz[0]='\0';
    strcat(HelpTextz,"Hello this can be much longer");
    strcat(HelpTextz,"You can write everything you want");
    return HelpTextz;
}

In your dialog
Code:

ShowPlayerDialog(playerid, dGPS+3, DIALOG_STYLE_TABLIST_HEADERS, "HQ-uri",HelpText(),"Ok","");


All times are GMT. The time now is 04:52 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.