SA-MP Forums Archive
Message problem - 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: Message problem (/showthread.php?tid=636790)



Message problem - Barnwell - 04.07.2017

Hello All im trying to put a new msg on the /stats
I change the new msg[508] to msg[950] and its not showing the full stats
Here is the codes:
PHP код:
    if(EAdminFlags:GetPVarInt(playerid"AdminFlags") != EAdminFlags_None) {
        
format(msgsizeof(msg), "NumAJails:{FFFFFF}[%s] NumKicks:{FFFFFF}[%s] {0000FF}NumBans{FFFFFF}[%s] {0000FF}Wealth:{FFFFFF}[%s]\n",getNumberString(GetPVarInt(targetid"NumAJAils")),getNumberString(GetPVarInt(targetid"NumKicks")), getNumberString(GetPVarInt(targetid"NumBans")),getNumberString(getTotalWealth(targetid)));
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg);
        
strcat(querymsgsizeof(query));
    } 
Its not showing the full code of it
it just showing NumAJails and NumKicks and Numbans and its showing Wea
Not Wealth


Re: Message problem - Meller - 04.07.2017

How many cells are query?


Re: Message problem - mongi - 04.07.2017

Try using 1024 as lenth
msg[1024]


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
How many cells are query?
Doesn't matter.

Your issue is the fact that SAMP doesn't support chat messages that are longer than a certain number of characters(144? I think.) You can split messages into two.


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by mongi
Посмотреть сообщение
Try using 1024 as lenth
msg[1024]
So you just place random cell sizes? You don't optimize your code at all? Ok.

Quote:
Originally Posted by Rufio
Посмотреть сообщение
Doesn't matter.

Your issue is the fact that SAMP doesn't support chat messages that are longer than a certain number of characters(144? I think.) You can split messages into two.
Actually it do matter, if you use common sense and actually read his code. He's using \n which by a quick thinking of "common sense" tells me that he's doing this for a dialog, which explains his "strcat".

@OP:
Run this debug for me please:
PHP код:
printf("DEBUG: Variable query has a default cell sizes of (%i) and has (%i/%i) in use and can handle %i more."1024strlen(query), 10241024-strlen(query));
    if(
EAdminFlags:GetPVarInt(playerid"AdminFlags") != EAdminFlags_None) { 
        
printf("DEBUG: Variable msg has a default cell sizes of (%i) and has (%i/%i) in use and can handle %i more."950strlen(msg), 950950-strlen(msg));
        
format(msgsizeof(msg), "NumAJails:{FFFFFF}[%s] NumKicks:{FFFFFF}[%s] {0000FF}NumBans{FFFFFF}[%s] {0000FF}Wealth:{FFFFFF}[%s]\n",getNumberString(GetPVarInt(targetid"NumAJAils")),getNumberString(GetPVarInt(targetid"NumKicks")), getNumberString(GetPVarInt(targetid"NumBans")),getNumberString(getTotalWealth(targetid))); 
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg); 
        
strcat(querymsgsizeof(query)); 
     } 
(Sorry for unneeded %i, I'm tired lmao)


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
Actually it do matter, if you use common sense and actually read his code. He's using \n which by a quick thinking of "common sense" tells me that he's doing this for a dialog, which explains his "strcat".

@OP:
Run this debug for me please:
PHP код:
printf("DEBUG: Variable query has a default cell sizes of (%i) and has (%i/%i) in use and can handle %i more."1024strlen(query), 10241024-strlen(query));
    if(
EAdminFlags:GetPVarInt(playerid"AdminFlags") != EAdminFlags_None) { 
        
printf("DEBUG: Variable msg has a default cell sizes of (%i) and has (%i/%i) in use and can handle %i more."950strlen(msg), 950950-strlen(msg));
        
format(msgsizeof(msg), "NumAJails:{FFFFFF}[%s] NumKicks:{FFFFFF}[%s] {0000FF}NumBans{FFFFFF}[%s] {0000FF}Wealth:{FFFFFF}[%s]\n",getNumberString(GetPVarInt(targetid"NumAJAils")),getNumberString(GetPVarInt(targetid"NumKicks")), getNumberString(GetPVarInt(targetid"NumBans")),getNumberString(getTotalWealth(targetid))); 
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg); 
        
strcat(querymsgsizeof(query)); 
     } 
(Sorry for unneeded %i, I'm tired lmao)
And if you use "common sense", you can clearly see there is a SendClientMessage and string is formatted for that SendClientMessage. No, it doesn't matter.

Also, it's always good to educate yourself, have a read;
https://sampwiki.blast.hk/wiki/Strcat

strcat isn't a dialog exclusive function.


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by Rufio
Посмотреть сообщение
And if you use "common sense", you can clearly see there is a SendClientMessage and string is formatted for that SendClientMessage. No, it doesn't matter.
And you clearly don't see that it is commented? Mhm.




Re: Message problem - Barnwell - 04.07.2017

Quote:
Originally Posted by mongi
Посмотреть сообщение
Try using 1024 as lenth
msg[1024]
Its not working


Re: Message problem - mongi - 04.07.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
So you just place random cell sizes? You don't optimize your code at all? Ok.
Seriously didn't script from almost a year lol, and this is the max string lenth as i remember.

Just tryin to help


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
View Post
Dear non common sense people, let's see how he's trying to output his code:
This code is taken from the same gamemode as his:
PHP Code:
SendStats(playerid,targetid) {
    new 
msg[508];
    
query[0] = 0;
    new 
name[250];
    if(
GetPVarInt(targetid"DonateRank") < 1)
    {
        
format(name,sizeof(name),"                                    {FF0000}%s",GetPlayerNameEx(targetid,ENameType_CharName));
    }
    if(
GetPVarInt(targetid"DonateRank") > && GetPVarInt(playerid"DonateRank") < 4)
    {
        
format(name,sizeof(name),"                                    {FFFF00}%s",GetPlayerNameEx(targetid,ENameType_CharName));
    }
    if(
GetPVarInt(targetid"DonateRank") == 4)
    {
        
format(name,sizeof(name),"                                    {FF33FF}%s",GetPlayerNameEx(targetid,ENameType_CharName));
    }
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
new spousename[MAX_PLAYER_NAME+1];
    
GetPVarString(targetid"SpouseName"spousenamesizeof(spousename));
    
format(msg,sizeof(msg),"{FFFFFF}Level:[%s] Sex:[%s] Cash:[$%s] Bank:[$%s] Spouse:[%s]\n",getNumberString(GetPVarInt(targetid,"Level")),GetSexName(GetPVarInt(targetid,"Sex")),getNumberString(GetPVarInt(targetid,"Money")),getNumberString(GetPVarInt(targetid,"Bank")),spousename);
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    if(
GetPVarInt(targetid"DonateRank") < 1)
    {
        
format(msg,sizeof(msg),"{FFFFFF}DonateRank:[%s] Donate Points:[%s] Phone:[%d] LottoNr:[%d] Job:[%s]\n",GetDonateRank(GetPVarInt(targetid,"DonateRank")),getNumberString(GetPVarInt(targetid,"DonatePoints")),GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")));
    }
    if(
GetPVarInt(targetid"DonateRank") > && GetPVarInt(playerid"DonateRank") < 4)
    {
        
format(msg,sizeof(msg),"{FFFFFF}DonateRank:[{FFFF00}%s{FFFFFF}] Donate Points:[{FFFF00}%s{FFFFFF}] Phone:[%d] LottoNr:[%d] Job:[%s]\n",GetDonateRank(GetPVarInt(targetid,"DonateRank")),getNumberString(GetPVarInt(targetid,"DonatePoints")),GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")));
    }
    if(
GetPVarInt(targetid"DonateRank") == 4)
    {
        
format(msg,sizeof(msg),"{FFFFFF}DonateRank:[{FF33FF}%s{FFFFFF}] Donate Points:[{FF33FF}%s{FFFFFF}] Phone:[%d] LottoNr:[%d] Job:[%s]\n",GetDonateRank(GetPVarInt(targetid,"DonateRank")),getNumberString(GetPVarInt(targetid,"DonatePoints")),GetPVarInt(targetid,"PhoneNumber"),getPlayerLottoTicket(targetid),GetJobName(GetPVarInt(targetid,"Job")));
    }
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    
format(msg,sizeof(msg),"{FFFFFF}WantedLevel:[%d] TimesArrested:[%s] FightStyle:[%s]\n",GetPlayerWantedLevel(playerid),getNumberString(GetPVarInt(targetid,"TimesArrested")),GetFightStyle(GetPVarInt(targetid"FightStyle")));
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    new 
nextlevel = (GetPVarInt(targetid,"Level")+1);
    new 
expamount nextlevel*levelexp;
    
format(msg,sizeof(msg),"Respect:[%s/%s] SpecialItem:[%s] Hunger:[%d]\n",getNumberString(GetPVarInt(targetid,"RespectPoints")),getNumberString(expamount),GetPlayerCarryingItemName(targetid),GetHungerLevel(targetid));
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    
format(msg,sizeof(msg),"{FFFFFF}Cigars:[%s] LockPicks:[%s] FurnitureTokens:[%d] WTChan:[%d]\n",getNumberString(GetPVarInt(targetid"Cigars")),getNumberString(GetPVarInt(targetid"VehLockpicks")),GetPVarInt(targetid"FurnitureTokens"),GetPVarInt(targetid"WTChannel"));
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    
format(msg,sizeof(msg),"{FFFFFF}Pot:[%s Gram] Coke:[%s Gram] Meth:[%s Gram]\n",getNumberString(GetPVarInt(targetid"Pot")),getNumberString(GetPVarInt(targetid"Coke")),getNumberString(GetPVarInt(targetid"Meth")));
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    
format(msg,sizeof(msg),"{FFFFFF}Type A:[%s Packs] Type B:[%s Packs] Type C:[%s Packs]\n",getNumberString(GetPVarInt(targetid"MatsA")),getNumberString(GetPVarInt(targetid"MatsB")),getNumberString(GetPVarInt(targetid"MatsC")));
    
//SendClientMessage(playerid, COLOR_LIGHTRED, msg);
    
strcat(querymsgsizeof(query));
    new 
fid GetPVarInt(targetid,"Family");
    if(
fid != 0) {
        
fid FindFamilyBySQLID(fid);
    } else 
fid = -1;
    if(
fid == -&& GetPVarInt(targetid"Faction") != 0) {
        
fid GetPVarInt(targetid"Faction");
        
format(msg,sizeof(msg),"{FFFFFF}Faction:[%s] Rank:[%s]\n",GetFactionName(fid),getFactionRankName(fid,GetPVarInt(targetid"Rank")));
        
//SendClientMessage(playerid, COLOR_WHITE, msg);
        
strcat(querymsgsizeof(query));
        
    } else if(
fid != -1) {
        
format(msg,sizeof(msg),"{FFFFFF}Family:[%s] Rank:[%s]\n",GetFamilyName(fid),getRankName(fid,GetPVarInt(targetid"Rank")));
        
//SendClientMessage(playerid, COLOR_WHITE, msg);
        
strcat(querymsgsizeof(query));
    }
    
format(msg,sizeof(msg),"{FFFFFF}PlayingHours:[%s] NewbChat Rank:[%s] Cookies:[%s]\n",getNumberString(GetPVarInt(targetid,"ConnectTime")),GetNewbieName(targetid),getNumberString(GetPVarInt(targetid,"Cookies")));
    
//SendClientMessage(playerid, COLOR_WHITE, msg);
    
strcat(querymsgsizeof(query));
    
    new 
matpacks[3], drugpacks[3];
    
matpacks[0] = GetPVarInt(playerid"MatAPacks");
    
matpacks[1] = GetPVarInt(playerid"MatBPacks");
    
matpacks[2] = GetPVarInt(playerid"MatCPacks");
    
drugpacks[0] = GetPVarInt(playerid"PotSeeds");
    
drugpacks[1] = GetPVarInt(playerid"CokePlants");
    
drugpacks[2] = GetPVarInt(playerid"MethMaterials");
    if(
matpacks[0] != || matpacks[1] != || matpacks[2] != 0) {
        
format(msg,sizeof(msg),"{FFFFFF}MatAPacks:[%s] MatBPacks:[%s] MatCPacks:[%s]\n",getNumberString(matpacks[0]),getNumberString(matpacks[1]),getNumberString(matpacks[2]));
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg);
        
strcat(querymsgsizeof(query));
    }
    
    if(
drugpacks[0] != || drugpacks[1] != || drugpacks[2] != 0) {
        
format(msg,sizeof(msg),"{FFFFFF}PotSeeds:[%s] CokePlants:[%s] MethMaterials:[%s]\n",getNumberString(drugpacks[0]),getNumberString(drugpacks[1]),getNumberString(drugpacks[2]));
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg);
        
strcat(querymsgsizeof(query));
    }
    
    new 
jailtime GetPVarInt(targetid"ReleaseTime");
    if(
jailtime == 0) {
        
jailtime GetPVarInt(targetid"AJailReleaseTime");
    }
    
jailtime -= gettime();
    if(
jailtime 0) {
        
format(msgsizeof(msg), "{FFFFFF}Jail Time Left: %s sec\n"getNumberString(jailtime));
        
//SendClientMessage(playerid, isajail?COLOR_LIGHTRED:COLOR_WHITE, msg);
        
strcat(querymsgsizeof(query));
    }
    if(
EAdminFlags:GetPVarInt(playerid"AdminFlags") != EAdminFlags_None) {
        
format(msgsizeof(msg), "{FFFFFF}NumAJails:[%s] NumKicks:[%s] NumBans[%s] Wealth:[%s]\n",getNumberString(GetPVarInt(targetid"NumAJAils")),getNumberString(GetPVarInt(targetid"NumKicks")), getNumberString(GetPVarInt(targetid"NumBans")),getNumberString(getTotalWealth(targetid)));
        
//SendClientMessage(playerid, COLOR_LIGHTRED, msg);
        
strcat(querymsgsizeof(query));
    }
    
ShowPlayerDialog(playeridERP_ViewStatsDIALOG_STYLE_MSGBOXname,query,"Close""");
    
//SendClientMessage(playerid, COLOR_WHITE,"_______________________________________");

Don't play smartass with me next time, I know what strcat is.
You obviously don't.

Quote:
Originally Posted by Meller
View Post
He's using \n which by a quick thinking of "common sense" tells me that he's doing this for a dialog, which explains his "strcat".
It doesn't explain his strcat. Strcat concatenates two strings. It isn't a dialog exclusive function. It can be used anywhere two strings are present. Moving on;

Quote:

He's using \n

Could just be a console C scripter trying his luck with PAWN. The only one acting smart is you unfortunately.


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by Rufio
View Post
You obviously don't.



It doesn't explain his strcat. Strcat concatenates two strings. It isn't a dialog exclusive function. It can be used anywhere two strings are present. Moving on;



Could just be a console C scripter trying his luck with PAWN. The only one acting smart is you unfortunately.
Oh god, I knew exactly from his little code and from his name and avatar which script he was scripting on as I played there recently and had a server with the same script. And knowing just that made me realize after my first post that I could just look at the code myself and point out a small debug printf that he could use. And having strcat to a string AFTER the message was sent doesn't make any realistic sense to me. To add something that already was sent in a message to the client, to add this to a bigger string and store it there for nothing doesn't make any sense. And I already knew his full code, so I knew instantly that he used \n for a dialog and then added that string to the bigger string. But he's doing it wrong anyway, he shouldn't use query's variable as in the gamemode it was created for mysql's query. But everyone may code as they want. Please stop bullshitting as I actually know what I'm doing, where you don't. I knew from just his name what he was struggling with.



@OP:
Get on skype and I'll help you in screenshare, you know who I am. xd


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
View Post
Oh god, I knew exactly from his little code and from his name and avatar which script he was scripting on as I played there recently and had a server with the same script. And knowing just that made me realize after my first post that I could just look at the code myself and point out a small debug printf that he could use. And having strcat to a string AFTER the message was sent doesn't make any realistic sense to me. To add something that already was sent in a message to the client, to add this to a bigger string and store it there for nothing doesn't make any sense. And I already knew his full code, so I knew instantly that he used \n for a dialog and then added that string to the bigger string. But he's doing it wrong anyway, he shouldn't use query's variable as in the gamemode it was created for mysql's query. But everyone may code as they want. Please stop bullshitting as I actually know what I'm doing, where you don't. I knew from just his name what he was struggling with.



@OP:
Get on skype and I'll help you in screenshare, you know who I am. xd
You should probably drink a glass of cold water and calm down before calling out an Computer Engineer on not knowing what they're talking about and before drinking a glass of water, open youtube and search for some grammar 101 lessons. :/


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by Rufio
View Post
You should probably drink a glass of cold water and calm down before calling out an Computer Engineer on not knowing what they're talking about and before drinking a glass of water, open youtube and search for some grammar 101 lessons. :/
I love taking feedback about my grammar, but what I don't like is people giving sarcastic feedback. If you'd point of what "mistakes" I make in my English grammar, I'd love to write it down and pay attention to it.

Thanks?


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
View Post
I love taking feedback about my grammar, but what I don't like is people giving sarcastic feedback. If you'd point of what "mistakes" I make in my English grammar, I'd love to write it down and pay attention to it.

Thanks?
If you don't like being given sarcastic feedback, be less hostile towards people replying to you and don't act as if you're some sort of a computer engineer working for a major computing company, you're only scripting PAWN here. I've given up on this god forgotten language a while ago and I was casually browsing forums. You reminded me why I quit PAWN in the first place.


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by Rufio
View Post
If you don't like being given sarcastic feedback, be less hostile towards people replying to you and don't act as if you're some sort of a computer engineer working for a major computing company, you're only scripting PAWN here. I've given up on this god forgotten language a while ago and I was casually browsing forums. You reminded me why I quit PAWN in the first place.
Great, that was my mission I guess. Time for me to also leave SAMP because I've got no life and are just posting sarcastic feedback to everyone?

- That's not how life works bud'.


Re: Message problem - Rufio - 04.07.2017

Quote:
Originally Posted by Meller
View Post
Great, that was my mission I guess. Time for me to also leave SAMP because I've got no life and are just posting sarcastic feedback to everyone?

- That's not how life works bud'.
Too bad you're acting all smart when you couldn't even understand the main purpose of my post above. Amusing. Enjoy your day.


Re: Message problem - Sew_Sumi - 04.07.2017

I'd suggest to the OP to ignore both the guessers in this situation...


Re: Message problem - Meller - 04.07.2017

Quote:
Originally Posted by Sew_Sumi
View Post
I'd suggest to the OP to ignore both the guessers in this situation...
Guessers? I already asked the @OP for a small debug of the sizes of the strings, all I can do after that guess since he's not responding to the first post I made.


Re: Message problem - Sew_Sumi - 04.07.2017

Not you lol. Rufio and mongi.