SA-MP Forums Archive
їPor quй no funciona? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: їPor quй no funciona? (/showthread.php?tid=590398)



їPor quй no funciona? - Fagrinht - 28.09.2015

Pues, al poner el comando en cualquier camiуn para cargarlo dice "Ese camiуn ya estб en uso" cuando nadie lo usу, es del trabajo de camionero. al comando deberнa de marcarte el CP y eso normalmente para que todo lo demбs funcione bien.

Код:
if(strcmp(cmd, "/cargar", true) == 0) //Cargar
{
	new opcion[25];
	opcion = strtok(cmdtext, idx);
	if(!strlen(opcion))
	{
		SendClientMessage(playerid, Naranja, "* /Cargar [Opciуn]");
		SendClientMessage(playerid, Naranja, "Opciones: Camion,Avion");
		return 1;
	}
	if(strcmp(opcion,"camion",true) == 0)
	{
		if(PlayerInfo[playerid][pTrabajo] != 1) return SendClientMessage(playerid,Rojo,"* No eres camionero");
		{
			if(Cargado[playerid] == 1) return SendClientMessage(playerid, Rojo, "* Debes entregar el otro camiуn antes de hacer otro viaje.");
			if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Rojo, "* Ese camion ya estб en uso.");
			new vehicleid = GetPlayerVehicleID(playerid);
			if(IsCamion(vehicleid))
			{
				if(Chofer[GetPlayerVehicleID(playerid)] == INVALID_PLAYER_ID)
				{
					SendClientMessage(playerid, Blanco, "Dirijete al punto rojo marcado en el mapa para poder cargar el camiуn.");
					SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
				}
				else SendClientMessage(playerid, Rojo, "* Ese camion ya estб en uso.");
			}
			else SendClientMessage(playerid, Rojo, "* Necesitas estar en un camiуn.");
		}
	}
	return 1;
}



Respuesta: їPor quй no funciona? - Fagrinht - 29.09.2015

Nadie me ayuda...


Respuesta: їPor quй no funciona? - Zume - 29.09.2015

En algъn momento le pones Chofer[cocheid] = INVALID_VEHICLE_ID ? si haces eso tendrias que ponerselo a todos (o sea hacer un bucle) al cargar el coche o los coches


Respuesta: їPor quй no funciona? - Ghost112397 - 29.09.2015

їEstбs seteando la variable por defecto de los camiones en INVALID_PLAYER_ID?


Respuesta: їPor quй no funciona? - Fagrinht - 29.09.2015

En OnPlayerDisconnect esta asн

Код:
	for(new i=0;i<MAX_VEHICLES;i++)
	{
	    if(Chofer[i] == playerid)
	    {
	    Chofer[i] = INVALID_PLAYER_ID;
	    CamionCargado[i] = 0;
	    }
	}
	for(new i=0;i<MAX_VEHICLES;i++)
	{
	    if(CamionCargado[CamionID[playerid]] == 1)
	    {
	        //Respawnear(CamionID[playerid]);
	        CamionCargado[CamionID[playerid]] = 0;
	        Chofer[CamionID[playerid]] = INVALID_PLAYER_ID;
	    }
	}



Respuesta: їPor quй no funciona? - Ghost112397 - 29.09.2015

Y al momento de spawnear el camiуn tu lo seteas a INVALID_PLAYER_ID?


Respuesta: їPor quй no funciona? - Fagrinht - 29.09.2015

Quote:
Originally Posted by Ghost112397
Посмотреть сообщение
Y al momento de spawnear el camiуn tu lo seteas a INVALID_PLAYER_ID?
Solo puse un camiуn de prueba y esta como los demбs vehнculos de trabajos, asн:

AddStaticVehicleEx(456,1745.6877,-2072.1392,13.5060,358.5654,6,0,600); //Camiуn


Respuesta: їPor quй no funciona? - Ghost112397 - 29.09.2015

Quote:
Originally Posted by Fagrinht
Посмотреть сообщение
Solo puse un camiуn de prueba y esta como los demбs vehнculos de trabajos, asн:

AddStaticVehicleEx(456,1745.6877,-2072.1392,13.5060,358.5654,6,0,600); //Camiуn
Deberнas darles una ID respectiva a los camiones, hiciste tremendo embole con lo que hiciste.

Te podes guiar con lo siguiente:
PHP код:
#define MAX_CAMIONES 25
enum infocamiones
{
    
ID,
    
bool:Cargado,
    
Chofer
};
new 
InfoCamion[MAX_CAMIONES][infocamiones],ultimocamion;
public 
OnGameModeInit()
{
    
CrearCamion(456,1745.6877,-2072.1392,13.5060,358.5654,6,0,600);
    return 
1;
}
stock CrearCamion(model,Float:x,Float:y,Float:z,Float:r,c1,c2,respawntime)
{
    
InfoCamion[ultimocamion][ID] = AddStaticVehicleEx(model,x,y,z,r,c1,c2,respawntime);
    
InfoCamion[ultimocamion][Cargado] = false;
    
InfoCamion[ultimocamion][Chofer] = -1;
    
ultimocamion++;
}
stock EsUnCamion(vehicleid)
{
    for(new 
0MAX_CAMIONESi++) 
    { 
        if(
InfoCamion[i][ID] == vehicleid)
        {
            return 
true;
            break;
        }
    }
    return 
false;




Respuesta: їPor quй no funciona? - Fagrinht - 29.09.2015

Quote:
Originally Posted by Ghost112397
Посмотреть сообщение
Deberнas darles una ID respectiva a los camiones, hiciste tremendo embole con lo que hiciste.

Te podes guiar con lo siguiente:
PHP код:
#define MAX_CAMIONES 25
enum infocamiones
{
    
ID,
    
bool:Cargado,
    
Chofer
};
new 
InfoCamion[MAX_CAMIONES][infocamiones],ultimocamion;
public 
OnGameModeInit()
{
    
CrearCamion(456,1745.6877,-2072.1392,13.5060,358.5654,6,0,600);
    return 
1;
}
stock CrearCamion(model,Float:x,Float:y,Float:z,Float:r,c1,c2,respawntime)
{
    
InfoCamion[ultimocamion][ID] = AddStaticVehicleEx(model,x,y,z,r,c1,c2,respawntime);
    
InfoCamion[ultimocamion][Cargado] = false;
    
InfoCamion[ultimocamion][Chofer] = -1;
    
ultimocamion++;
}
stock EsUnCamion(vehicleid)
{
    for(new 
0MAX_CAMIONESi++) 
    { 
        if(
InfoCamion[i][ID] == vehicleid)
        {
            return 
true;
            break;
        }
    }
    return 
false;

Al poner todo asн me tira un error en una funciуn cuando cargas el camiуn

Код:
function TrabajoCamionero(playerid, Tipo)
{
	if(Tipo == EntregarArmero)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid] =1;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == Entregar247)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=4;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == EntregarDroga)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=3;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == EntregarRopa)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=2;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == CargarArmas)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=1;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid, 2461.9583,-2617.2573,13.5539,7.0);
	}
	else if(Tipo == CargarRopa)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=2;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid,2234.5420,-1689.8008,13.8677 ,7.0);
	}
	else if(Tipo == CargarDrogas)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=3;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid,2362.1731,-1180.6930,27.5124,7.0);
	}
	else if(Tipo == Cargar247)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=4;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid, 1838.1060,-1831.8807,13.4781,7.0);
	}
    return 1;
}
Lo que dice "Cargado[playerid]=2;" lanza error:

error 028: invalid subscript (not an array or too many subscripts): "Cargado"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line


Respuesta: їPor quй no funciona? - Ghost112397 - 29.09.2015

Quote:
Originally Posted by Fagrinht
Посмотреть сообщение
Al poner todo asн me tira un error en una funciуn cuando cargas el camiуn

Код:
function TrabajoCamionero(playerid, Tipo)
{
	if(Tipo == EntregarArmero)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid] =1;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == Entregar247)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=4;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == EntregarDroga)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=3;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == EntregarRopa)
	{
	SendClientMessage(playerid,-1,"Entrega el camiуn en condiciones para poder recibir el pago.");
	TogglePlayerControllable(playerid,1);
	Cargamento[playerid]=2;
	SetPlayerCheckpoint(playerid,-116.3876,-322.6960,1.4928,7.0);
	Cargado[playerid]=2;
	}
	else if(Tipo == CargarArmas)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=1;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid, 2461.9583,-2617.2573,13.5539,7.0);
	}
	else if(Tipo == CargarRopa)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=2;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid,2234.5420,-1689.8008,13.8677 ,7.0);
	}
	else if(Tipo == CargarDrogas)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=3;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid,2362.1731,-1180.6930,27.5124,7.0);
	}
	else if(Tipo == Cargar247)
	{
	SendClientMessage(playerid,-1,"Tu camiуn fuй cargado correctamente, lleva el camiуn al punto rojo marcado en el mapa.");
	Cargamento[playerid]=4;
	TogglePlayerControllable(playerid,1);
	SetPlayerCheckpoint(playerid, 1838.1060,-1831.8807,13.4781,7.0);
	}
    return 1;
}
Lo que dice "Cargado[playerid]=2;" lanza error:

error 028: invalid subscript (not an array or too many subscripts): "Cargado"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Las variables del sistema que te pasй, se usa asн: InfoCamion[camionid][Cargado] = true
Recuerda que es un boleano.