View Single Post
Old 07/11/2019, 05:44 PM   #12
RoboN1X
Huge Clucker
 
RoboN1X's Avatar
 
Join Date: Feb 2011
Location: Indonesia
Posts: 445
Reputation: 128
Default Re: /wantedcars list Command is bugging

Quote:
Originally Posted by ImTobi View Post
Code:
enum WantedCarsEnum{
	id,
	WantedKennzeichen[128],
	WantedGrund[128],
	CarModel[128]
}
Code:
new wInfo[100][WantedCarsEnum];

i don't get what you are saying with mysql and the string, i understand normal english words lol xD
I meant you format the string like this (appended):
pawn Code:
format(string,sizeof(string),"%s\t%s\t%s\n%s",wInfo[i][CarModel],wInfo[i][WantedKennzeichen],wInfo[i][WantedGrund],string);
Instead of this: (preppended)
pawn Code:
format(string,sizeof(string),"%s%s\t%s\t%s\n",string,wInfo[i][CarModel],wInfo[i][WantedKennzeichen],wInfo[i][WantedGrund]);
Well i can understand if your reason is to list from bottom to top...

And that why you use 128 128 128 for that sizes in the enums? Are the wanted vehicle model names actually very long up to 128 characters? The samp command input is only max to 128 characters, are you sure you can add all 128+128+128 parameters in command that only fit 128 characters? No... So distribute the size accordingly...

Sorry since i dont speak deutsch, idk the meaning of enums and purpose for it...

How do you assign the ID when it has no data loaded?

You should also check first if the array index is not empty, either you mark the id with some special value or maybe use strlen on the CarModel before formatting it as dialog item.
So like
pawn Code:
if (strlen(wInfo[i][CarModel]))
{
     format( ... )
}
With this, only entries of wanted car that has car model name will be added into the dialog list
__________________
Need Help? Use Search, WIKI, and FAQ
RoboN1X is offline   Reply With Quote