[Help] Message Cutting Off
#1

So, I am working on a credit system and one of the options is to get a house, now, when the player clicks on the house option it takes the amount of credits and it is suppose to send this message to an admin. "[CreditShop]: (NAME) has exchanged 100 credits for a house. Please issue it now."

However whenever I test it IG I get this message
"[CreditShop]: (NAME) has exchanged "

This is the code for the dialog option.

Код HTML:
			if(listitem == 5) // Gate
			{
			    new string[42], giveplayerid, shopstring[512];
				if(PlayerInfo[playerid][pCredits] < 100)
				{
					return SendClientMessageEx(playerid, COLOR_GREY, "   You do not have enough Credits !");
				}
				else
				{
					PlayerInfo[playerid][pCredits] = PlayerInfo[playerid][pCredits]-100;
					format(string, sizeof(string), "[CreditShop]: %s has exchanged 100 credits for a house. Please issue it now.", GetPlayerNameEx(giveplayerid));
					ShopTechBroadCast(COLOR_SHOP, string);
					return SendClientMessageEx(playerid, COLOR_GREY, "   You exchanged 100 Credits for a house gate. !");
				}
			}
Reply
#2

Try this
pawn Код:
if(listitem == 5) // Gate
            {
                new string[42], giveplayerid, shopstring[512];
                if(PlayerInfo[playerid][pCredits] < 100)
                {
                    return SendClientMessageEx(playerid, COLOR_GREY, "   You do not have enough Credits !");
                }
                else
                {
                    new PName[MAX_PLAYER_NAME];
                    GetPlayerName(giveplayerid, PName, sizeof(PName));
                    PlayerInfo[playerid][pCredits] = PlayerInfo[playerid][pCredits]-100;
                    format(string, sizeof(string), "[CreditShop]: %s has exchanged 100 credits for a house. Please issue it now.", PName);
                    ShopTechBroadCast(COLOR_SHOP, string);
                    return SendClientMessageEx(playerid, COLOR_GREY, "   You exchanged 100 Credits for a house gate. !");
                }
            }
Reply
#3

change
pawn Код:
new string[42]
to

pawn Код:
new string[128]
Without a players name that text alone takes up ~52 cells you need to increase the size of your string a significant bit. Anything related to SendClientMessage has a cap of 128 characters so anything higher then that is a waist of memory.
Reply
#4

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Try this
pawn Код:
if(listitem == 5) // Gate
            {
                new string[42], giveplayerid, shopstring[512];
                if(PlayerInfo[playerid][pCredits] < 100)
                {
                    return SendClientMessageEx(playerid, COLOR_GREY, "   You do not have enough Credits !");
                }
                else
                {
                    new PName[MAX_PLAYER_NAME];
                    GetPlayerName(giveplayerid, PName, sizeof(PName));
                    PlayerInfo[playerid][pCredits] = PlayerInfo[playerid][pCredits]-100;
                    format(string, sizeof(string), "[CreditShop]: %s has exchanged 100 credits for a house. Please issue it now.", PName);
                    ShopTechBroadCast(COLOR_SHOP, string);
                    return SendClientMessageEx(playerid, COLOR_GREY, "   You exchanged 100 Credits for a house gate. !");
                }
            }
Did not seem to work
Reply
#5

Change the string size from 42 to 128
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)