SA-MP Forums Archive
Input Line too long - 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: Input Line too long (/showthread.php?tid=391679)



Input Line too long - Blackazur - 11.11.2012

Hey Guys, i have a Error " error 075: input line too long (after substitutions)" in this Line "ShowPlayerDialog":

Код:
COMMAND:weapons(playerid,params[])
{
	if(PlayerTeam[playerid] != TEAM_HUMAN) return SendClientMessage(playerid,COLOR_RED,"You are not an Human-Member!");
	
	ShowPlayerDialog(playerid,DIALOG_WEAPONS,DIALOG_STYLE_LIST,"Weapon-Menu","9mm's - $250\nSilenced 9mm - $500\nSawnOff - $30000\nCombat Shotgun - $1500\nMicro UZIs - $2000\nMP5 - $2500\nAK47 - $3000\nCountry Rifle - $5000\nSniper Rifle - $15000\nArmour - $20000\nFlamethrower - $700000\nSpraycan - $10000\nKatana - $500\nTec9 - $400\nDildo - $5\nBaseball Bat - $1000\nFlowers - $30\nSatchel Charges - $300000\nGrenades - $100000\nChainsaw - $15000\nFire Extinguisher - $15000\nRocket Launcher - $200000\nMinigun - $500000","OKAY","CANCEL");
	return 1;
}
Know everyone an Answer?


Re: Input Line too long - InfiniTy. - 11.11.2012

Use strcat

https://sampwiki.blast.hk/wiki/Strcat


AW: Input Line too long - Blackazur - 11.11.2012

I understand this not, what must i now make with strcat?


Re: AW: Input Line too long - InfiniTy. - 11.11.2012

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
I understand this not, what must i now make with strcat?
pawn Код:
new string[512];
strcat(string,"9mm's - $250\nSilenced 9mm - $500\nSawnOff - $30000\nCombat Shotgun - $1500\nMicro UZIs - $2000\nMP5 - $2500\nAK47 - $3000\n");
strcat(string,"Country Rifle - $5000\nSniper Rifle - $15000\nArmour - $20000\nFlamethrower - $700000\nSpraycan - $10000\n");
strcat(string,"Katana - $500\nTec9 - $400\nDildo - $5\nBaseball Bat - $1000\nFlowers - $30\nSatchel Charges - $300000\n");
strcat(string,"Grenades - $100000\nChainsaw - $15000\nFire Extinguisher - $15000\nRocket Launcher - $200000\nMinigun - $500000");
ShowPlayerDialog(playerid,DIALOG_DOWEAPONS,DIALOG_STYLE_LIST,"Weapon-Menu",string,"OKAY","CANCEL");



AW: Input Line too long - Blackazur - 11.11.2012

Код:
COMMAND:weapons(playerid,params[])
{
	if(PlayerTeam[playerid] != TEAM_HUMAN) return SendClientMessage(playerid,COLOR_RED,"You are not an Human-Member!");
	
    new string[164] = "9mm's - $250\nSilenced 9mm - $500\nSawnOff - $30000\nCombat Shotgun - $1500\nMicro UZIs - $2000\nMP5 - $2500\nAK47 - $3000\n";
    strcat(string,"Country Rifle - $5000\nSniper Rifle - $15000\nArmour - $20000\nFlamethrower - $700000\nSpraycan - $10000\nKatana - $500\nTec9 - $400\nDildo - $5\nBaseball Bat - $1000\nFlowers - $30\nSatchel Charges - $300000\nGrenades - $100000\nChainsaw - $15000\nFire Extinguisher - $15000\nRocket Launcher - $200000\nMinigun - $500000");
    ShowPlayerDialog(playerid,DIALOG_WEAPONS,DIALOG_STYLE_LIST,"Weapon-Menu",string,"Okay","Cancel");
    return 1;
}
Thx, is that so right?


Re: AW: Input Line too long - InfiniTy. - 11.11.2012

I modified the code.. put that in.. the first code was a mistake


AW: Input Line too long - Blackazur - 11.11.2012

It works, thx, i give you +1 Rep.


AW: Input Line too long - Nero_3D - 11.11.2012

Just do it like that, move the long line in a seperated one (without commas)!
pawn Код:
//
    ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapon-Menu",
        "9mm's - $250\nSilenced 9mm - $500\nSawnOff - $30000\nCombat Shotgun - $1500\nMicro UZIs - $2000\nMP5 - $2500\nAK47 - $3000\nCountry Rifle - $5000\nSniper Rifle - $15000\nArmour - $20000\nFlamethrower - $700000\nSpraycan - $10000\nKatana - $500\nTec9 - $400\nDildo - $5\nBaseball Bat - $1000\nFlowers - $30\nSatchel Charges - $300000\nGrenades - $100000\nChainsaw - $15000\nFire Extinguisher - $15000\nRocket Launcher - $200000\nMinigun - $500000"
            , "OKAY", "CANCEL");
That will work because every seperated line gets his own limit (around ~500 char), you text is only 447 char long

If you go over the limit DONT use strcat, just use global variables
Because if you use strcat you do nothing else than contracting global saved data
With a global variable you dont need to contract if afterwards!