13.12.2015, 04:41
Buenas, el problema que tengo en la callback OnPlayerPickupPickup, es que sуlo se ejecuta un bucle y el otro no se ejecuta, llegue a pensar que era error de algъn if, pero los intercambie de lugar y ambos andan a la perfecciуn, el problema es que se coloco el de garajes primero no ejecuta el de las casa y viceversa.
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[256];
if (InfoUsuario[playerid][uPickup] != pickupid){
for (new g = 0; g <= MAX_GARAJES; g++)
{
if (GarajesE0[g] == pickupid || GarajesE1[g] == pickupid || GarajesS1[g] == pickupid || GarajesS2[g] == pickupid){
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
TextDrawShowForPlayer(playerid, InfoPickup[3]);
TextDrawShowForPlayer(playerid, InfoPickup[1]);
TextDrawShowForPlayer(playerid, InfoPickup[2]);
if (InfoGaraje[g][gPuerta] == 0){
format(string, sizeof(string), "~W~Lugar: ~B~Garaje~N~~W~Puerta: ~R~Cerrada ~N~");
}
if (InfoGaraje[g][gPuerta] == 1){
format(string, sizeof(string), "~W~Lugar: ~B~Garaje~N~~W~Puerta: ~G~Abierta ~N~");
}
TextDrawSetString(InfoPickup[2], string);
InfoUsuario[playerid][uPickup] = pickupid;
InfoUsuario[playerid][uPickup_X] = X;
InfoUsuario[playerid][uPickup_Y] = Y;
InfoUsuario[playerid][uPickup_Z] = Z;
return 1;
}
}
for (new i = 0; i <= MAX_CASAS; i++){
if (CasasP[i] == pickupid || CasasZ[i] == pickupid){
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if (InfoCasa[i][cComprada] == 0){
TextDrawShowForPlayer(playerid, InfoPickup[0]);
TextDrawShowForPlayer(playerid, InfoPickup[1]);
TextDrawShowForPlayer(playerid, InfoPickup[2]);
if (InfoCasa[i][cCerrada] == 0){
format(string, sizeof(string), "~W~Lugar: ~B~Casa~N~~W~Direccion: ~B~%s ~N~~W~Tipo: ~B~%s ~N~~W~Puerta: ~R~Cerrada ~N~~W~Precio: ~G~$%d~N~~W~Use: ~R~/Comprar Casa",
InfoCasa[i][cDireccion],
InfoCasa[i][cTipo],
InfoCasa[i][cPrecio]);
}
else if (InfoCasa[i][cCerrada] == 1){
format(string, sizeof(string), "~W~Lugar: ~B~Casa~N~~W~Direccion: ~B~%s ~N~~W~Tipo: ~B~%s ~N~~W~Puerta: ~G~Abierta ~N~~W~Precio: ~G~$%d~N~~W~Use: ~R~/Comprar Casa",
InfoCasa[i][cDireccion],
InfoCasa[i][cTipo],
InfoCasa[i][cPrecio]);
}
TextDrawSetString(InfoPickup[2], string);
InfoUsuario[playerid][uPickup] = pickupid;
InfoUsuario[playerid][uPickup_X] = X;
InfoUsuario[playerid][uPickup_Y] = Y;
InfoUsuario[playerid][uPickup_Z] = Z;
return 1;
}
else if (InfoCasa[i][cComprada] == 1){
TextDrawShowForPlayer(playerid, InfoPickup[0]);
TextDrawShowForPlayer(playerid, InfoPickup[1]);
TextDrawShowForPlayer(playerid, InfoPickup[2]);
if (InfoCasa[i][cCerrada] == 0){
format(string, sizeof(string), "~W~Lugar: ~B~Casa~N~~W~Descripcion: ~B~%s ~N~~W~Direccion: ~B~%s ~N~~W~Tipo: ~B~%s ~N~~W~Puerta: ~R~Cerrada ~N~",
InfoCasa[i][cTitulo],
InfoCasa[i][cDireccion],
InfoCasa[i][cTipo]);
}
else if (InfoCasa[i][cCerrada] == 1){
format(string, sizeof(string), "~W~Lugar: ~B~Casa~N~~W~Descripcion: ~B~%s ~N~~W~Direccion: ~B~%s ~N~~W~Tipo: ~B~%s ~N~~W~Puerta: ~G~Abierta ~N~",
InfoCasa[i][cTitulo],
InfoCasa[i][cDireccion],
InfoCasa[i][cTipo]);
}
TextDrawSetString(InfoPickup[2], string);
InfoUsuario[playerid][uPickup] = pickupid;
InfoUsuario[playerid][uPickup_X] = X;
InfoUsuario[playerid][uPickup_Y] = Y;
InfoUsuario[playerid][uPickup_Z] = Z;
return 1;
}
return 1;
}
}
}
return 1;
}