SA-MP Forums Archive
String cutoff - 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: String cutoff (/showthread.php?tid=376816)



String cutoff - HighFlyer - 11.09.2012

Hello there,

I have a problem where a faction name gets cut off in the chat, for instance, instead of "San Andreas Police Department", I get "San Andreas Police Depa". It is cut off everywhere, on dialogs, on /fadvert command... didn't see an occasion where it worked. I've read something about this, and I've increased FactionName string from 256 to 512 and I've tried the maximum of 1024 too, but none of these fixed the issue.

Код:
enum FactionData
{
	FactionName[512],
        ... // other stuff
};
Posting a bit of my /fadvert command

Код:
	    if(Player[playerid][FactionRank] >= 4)
	    {
			new message[128], string[256];
			if(sscanf(params, "s[128]", message))
			{
				SendClientMessage(playerid, WHITE, "Server: /fadvert [advertisement]");
				SendClientMessage(playerid, GREY, "Example: '/fadvert Here to save your lives everyday.'");
				SendClientMessage(playerid, GREY, "You will see: [FACTION ADVERT] Call 911 for any immediate reports on problems or crimes committed. [San Andreas Police Department]");
			}
			else
			{
			    format(string, sizeof(string), "[FACTION ADVERT] %s [%s]", message, Factions[Player[playerid][Faction]][FactionName]);
			    SendClientMessageToAll(ADVERT, string);
			}
		}



Re: String cutoff - zT KiNgKoNg - 11.09.2012

put your string for third message upto 600


Re: String cutoff - HighFlyer - 11.09.2012

I don't think that's going to work, but I'll have a try. The /fadvert string is really long, I spammed a bit of random letters into it, and it didn't cut off. The thing is that FactionName is cut off everywhere in the script. Any suggestions?


Re: String cutoff - zT KiNgKoNg - 11.09.2012

well set a max in the info and if it goes over that ammount send clientmessage(playerid,-1,"sorry you when't over the max limit sorry your advert could't be published");


Re: String cutoff - HighFlyer - 11.09.2012

Thanks for your help, but you're misunderstanding me. The advert is not the problem, the string of the FactionName gets cut off.


Re: String cutoff - zT KiNgKoNg - 11.09.2012

yes change string[256]; to string[500]; your string is too short since its 256 your message is taking over the name so put a limit on the message its self


Re: String cutoff - HighFlyer - 11.09.2012

I did that, and the result is still the same. Here's a picture, speaks a thousand words... :P




Re: String cutoff - zT KiNgKoNg - 11.09.2012

LOL. samp's chat only holds so much thats why i said put a cap on the ammount


Re: String cutoff - zT KiNgKoNg - 11.09.2012

try moving the name and message around


Re: String cutoff - HighFlyer - 11.09.2012

Actually, I'm pretty sure according to the limits page it holds 1024. I got this. What else should I change?

Код:
new message[128], string[500];
if(sscanf(params, "s[128]", message))