Strmid doen't work
#1

Hi...


I've a problem here:

i made a car system, it works fine. The only thing that doen't work is when the server loads the name of the owner ("Dono") of the vehicle. Look the code:


pawn Код:
strmid(CarroInfo[carroid][Dono], dini_Get(ficheiro, "Dono"), 0, strlen(dini_Get(ficheiro, "Dono")));
so, i tried other ways to do the same thing, but it keeps doesn't getting the name from the file:

pawn Код:
//1st try to correct the bug:
format(CarroInfo[carroid][Dono], sizeof(CarroInfo[carroid][Dono]), "%s", dini_Get(ficheiro, "Dono"));

//2nd try to correct the bug:
new donoName[MAX_PLAYER_NAME];
format(donoName, sizeof(donoName), "%s BUG",dini_Get(ficheiro, "Dono"));
strmid(CarroInfo[carroid][Dono],strSplit(donoName, " ", 0, false),0,strlen(strSplit(donoName, " ", 0, false)));

The server loads the name correctly, but the string CarroInfo[carroid][Dono] doesn't "saves" the loaded info. Heres a simple debug that i've done:

pawn Код:
printf("Carregado Carro %i, de %s. Modelo: %i", CarroInfo[carroid][NumId], CarroInfo[carroid][Dono], CarroInfo[carroid][Modelo]);
printf("Carregado Carro %i, de %s. Modelo: %i", CarroInfo[carroid][NumId], dini_Get(ficheiro, "Dono"), CarroInfo[carroid][Modelo]);
The result:

pawn Код:
[17:17:04] Carregado Carro 1, de . Modelo: 415//This line doesn't have the name
[17:17:04] Carregado Carro 1, de Andre_Almeida. Modelo: 415//This line have the name

Anyone can help me to solve this problem??
Thanks.


Sorry my bad english, i'm Portuguese.
Reply
#2

Try
pawn Код:
strcat(CarroInfo[carroid][Dono], dini_Get(ficheiro, "Dono"), MAX_PLAYER_NAME);
Reply
#3

It works...

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)