03.01.2018, 22:19
Actually i have a pocket system adapted to my gm, but the system isn't corrlation to the pocket system, that, must be a system similar to the system of LSRP.com or .es, I try to adapt this but say "You not close to the vehicle" when I'm next to the vehicle
I don't know if it a wrong adaptation or a function of the coords are wrong. My GM it's adaptation of Zc
This is the command
Thanks.
I don't know if it a wrong adaptation or a function of the coords are wrong. My GM it's adaptation of Zc
This is the command
PHP код:
CMD:maletero(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Rojo, "* No puedes abrir el maletero desde dentro de un vehнculo.");
if(Info[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
if(strcmp(params,"abrir",true) == 0) //Abrir maletero
{
new car,Float:fVehPos[3], Float:vX, Float:vY, Float:vZ,Float:distancia = 4.0;
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], fVehPos[0], fVehPos[1], fVehPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 4.0, fVehPos[0], fVehPos[1], fVehPos[2]) && !IsABike(d) && VehMaletero[d] == 1)
{
if(GetPlayerDistanceFromPoint(playerid, vX, vY, vZ) <= distancia)distancia = GetPlayerDistanceFromPoint(playerid, vX, vY, vZ), car = d;
}
}
new string[120];
if(car == 0){SendClientMessage(playerid, COLOR_WHITE, "* No se ha detectado ningъn vehнculo a tu alrededor que puedas abrir."); return 1;}
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,1,objective);
format(string, sizeof(string), "* %s abre el maletero de un vehнculo.", GetPlayerNameEx(playerid));
ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehMaletero[car] = 1;
MostrarMaletero(playerid, car);
VehMaleteroPlayer[playerid] = car;
return 1;
}
else if(strcmp(params,"ver",true) == 0) //Mostrar maletero
{
new car,Float:fVehPos[3], Float:vX, Float:vY, Float:vZ,Float:distancia = 4.0;
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], fVehPos[0], fVehPos[1], fVehPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 4.0, fVehPos[0], fVehPos[1], fVehPos[2]) && !IsABike(d) && VehMaletero[d] == 1)
{
if(GetPlayerDistanceFromPoint(playerid, vX, vY, vZ) <= distancia)distancia = GetPlayerDistanceFromPoint(playerid, vX, vY, vZ), car = d;
}
}
if(car == 0){SendClientMessage(playerid, COLOR_WHITE, "No se ha detectado ningъn vehнculo a tu alrededor con el maletero abierto."); return 1;}
MostrarMaletero(playerid, car);
VehMaleteroPlayer[playerid] = car;
return 1;
}
else if(strcmp(params,"cerrar",true) == 0) //Cerrar maletero
{
new car,Float:fVehPos[3], Float:vX, Float:vY, Float:vZ,Float:distancia = 4.0;
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], fVehPos[0], fVehPos[1], fVehPos[2]);
if(IsPlayerInRangeOfPoint(playerid, 4.0, fVehPos[0], fVehPos[1], fVehPos[2]) && !IsABike(d) && VehMaletero[d] == 1)
{
if(GetPlayerDistanceFromPoint(playerid, vX, vY, vZ) <= distancia)distancia = GetPlayerDistanceFromPoint(playerid, vX, vY, vZ), car = d;
}
}
new string[120];
if(car == 0){SendClientMessage(playerid, COLOR_WHITE, "No se ha detectado ningъn vehнculo a tu alrededor con el maletero abierto."); return 1;}
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,0,objective);
format(string, sizeof(string), "* %s cierra el maletero de un vehнculo.", GetPlayerNameEx(playerid));
ProxDetector(15.0, playerid, string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
VehMaletero[car] = 0;
return 1;
}
else{SendClientMessage(playerid, COLOR_WHITE, "/maletero [Abrir/Ver/Cerrar]");
return 1;
}
}