Duda con variable y dato tipo string
#1

Hola a todos,

Tengo un problema sobre esto. Tengo una variable que almacena datos tipo string(El nombre de un jugador) para mi sistema de casas

Код:
hInfo[housenumber][Name]=PlayerNamex(playerid); // El PlayerNamex obtiene el nombre del jugador por ejemplo obtiene el nombre "Player1"
ok todo bien por ahora, pero despues de cambiar el valor de la variable a otro texto(texto "En_Venta")

Код:
new enventa[30];
format(enventa, sizeof(enventa), "En_Venta");
hInfo[housenumber][Name]=strlen(enventa);
y el problema es que no me cambia el texto que le asignй, y me aparece el texto anterior "layer1" faltando la letra "P"
Reply
#2

No entiendo nada de programaciуn pero puede ser por el entrecomillado de "En_Venta" ?
Reply
#3

Pero primero probaste con string normal y si te funciono?
Reply
#4

Quote:
Originally Posted by wharlos
Посмотреть сообщение
Pero primero probaste con string normal y si te funciono?
como es eso del string normal? Sin "strlen"? (Disculpa soy algo n00b en esto )
Reply
#5

Que si antes lo probaste asн

Quote:

new string[30];
format(string, sizeof(string), "En_Venta");
hInfo[housenumber][Name] = strlen(string);

Reply
#6

Quote:
Originally Posted by wharlos
Посмотреть сообщение
Que si antes lo probaste asн
sigue igual (creo que el nombre de la variable no tiene nada que ver con eso)
Reply
#7

prueba asн

Код:
format(hInfo[housenumber][Name], sizeof(hInfo[housenumber][Name]), "En_Venta");
O coloca la linea donde defines "Name"
Reply
#8

Quote:
Originally Posted by Thewin
Посмотреть сообщение
prueba asн

Код:
format(hInfo[housenumber][Name], sizeof(hInfo[housenumber][Name]), "En_Venta");
O coloca la linea donde defines "Name"
Код:
enum HouseInfo
{
	Name[24], // la variable
	Cost,
	Interior,
	Virtualworld,
	Locked,
	Float:InteriorX,
	Float:InteriorY,
	Float:InteriorZ,
	Float:iconx,
	Float:icony,
	Float:iconz
}
new hInfo[MAX_HOUSES][HouseInfo];
Reply
#9

pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)

strcpy(hInfo[housenumber][Name], PlayerNamex(playerid), MAX_PLAYER_NAME);

strcpy(hInfo[housenumber][Name], "En_Venta", 10);
Reply
#10

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)

strcpy(hInfo[housenumber][Name], PlayerNamex(playerid), MAX_PLAYER_NAME);

strcpy(hInfo[housenumber][Name], "En_Venta", 10);
Gracias, funciona perfecto +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)