Strings cutting off. - 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: Strings cutting off. (
/showthread.php?tid=343922)
Strings cutting off. -
...: 1 :... - 19.05.2012
This is really annoying me now.
The string length is fine, it's just constantly cutting off.
Say if I said "Hello there my name is dasdhdashasd", it would say "Hello there my name i"
pawn Код:
command(vip, playerid, params[])
{
new message[500], string[500];
if(sscanf(params, "s", message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /(v)ip [message]");
}
else
{
if(Player[playerid][VipRank] >= 1)
{
if(strlen(message) < 1)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /(v)ip [message]");
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][VipRank] >= 1 && Player[i][ToggedVIP] == 0)
{
switch(Player[playerid][VipRank]) {
case 1: {
format(string, sizeof(string), "[V] Bronze VIP %s: %s", GetName(playerid), message);
SendClientMessage(i, VIP_BRONZE, string);
}
case 2: {
format(string, sizeof(string), "[V] Silver VIP %s: %s", GetName(playerid), message);
SendClientMessage(i, VIP_SILVER, string);
}
case 3: {
format(string, sizeof(string), "[V] Gold VIP %s: %s", GetName(playerid), message);
SendClientMessage(i, VIP_GOLD, string);
}
case 4: {
format(string, sizeof(string), "[V] Admin %s: %s", GetName(playerid), message);
SendClientMessage(i, VIP_ADMIN, string);
}
}
}
}
}
}
}
return 1;
}
Re: Strings cutting off. -
[ABK]Antonio - 19.05.2012
You can't send messages that big, that's why.
https://sampwiki.blast.hk/wiki/Limits
Re: Strings cutting off. -
Luis- - 19.05.2012
Try 's[500]' instead of 's' in the sscanf part.
Re: Strings cutting off. -
MP2 - 19.05.2012
Input is limited to 128 characters, so why on earth is your string 500 cells big?!