Bien, me instalй un fs de garages el cual pasй a mi gamemode ya que lo quiero adaptar y hacerlo bien.
El problema es que va todo bien pero..
A la hora de estacionar, mi coche se queda invisible aunque me pueda a montar a el, es invisible.
Код:
CMD:estacionar(playerid, params[])
{
if(Info[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
{
new ownerid = Info[playerid][pVehicleKeysFrom];
if(IsPlayerConnected(ownerid))
{
new d = Info[playerid][pVehicleKeys];
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[ownerid][d][pvId]))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "Tu debes ser el conductor.");
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
PlayerVehicleInfo[ownerid][d][pvHealth] = health;
//if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Tu vehнculo estб demasiado daсado para estacionarlo.");
if(Info[playerid][pLockCar] == GetPlayerVehicleID(playerid)) Info[playerid][pLockCar] = INVALID_VEHICLE_ID;
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(ownerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
SetPlayerArmedWeapon(playerid, 0);
new string[29 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s ha estacionado el vehiculo de %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
fVehSpeed[playerid] = 0.0;
return 1;
}
}
}
for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
{
if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "Tu debes ser el conductor.");
new Float:x, Float:y, Float:z, Float:angle, Float:health;
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
PlayerVehicleInfo[playerid][d][pvHealth] = health;
//if(health < 800) return SendClientMessageEx(playerid, COLOR_GREY, " Tu vehiculo estб muy daсado para estacionarlo.");
if(Info[playerid][pLockCar] == GetPlayerVehicleID(playerid)) Info[playerid][pLockCar] = INVALID_VEHICLE_ID;
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
SurfingCheck(GetPlayerVehicleID(playerid));
UpdatePlayerVehicleParkPosition(playerid, d, x, y, z, angle, health);
PutPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId], 0);
SetPlayerArmedWeapon(playerid, 0);
new string[30 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s ha estacionado su vehiculo.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
fVehSpeed[playerid] = 0.0;
return 1;
}
}
SendClientMessageEx(playerid, COLOR_GREY, "Tu necesitas estar dentro de tu vehiculo para hacer esto.");
return 1;
}
Код:
CMD:genter(playerid,params[])
{
for(new i=0; i < garageCount+1; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, gInfo[i][PosX], gInfo[i][PosY], gInfo[i][PosZ]))
{
if(gInfo[i][Locked] == 1 && strcmp(GetPlayerNameEx(playerid),gInfo[i][Owner])) return SendClientMessageEx(playerid,COLOR_ERROR,"No eres el dueсo de este garage, el garage estб cerrado");
new gtype = gInfo[i][Interior];
if(!IsPlayerInAnyVehicle(playerid))
{
SetPlayerVirtualWorld(playerid,gInfo[i][UID]);
SetPlayerInterior(playerid,floatround(GarageInteriors[gtype][4]));
SetPlayerPos(playerid,GarageInteriors[gtype][0],GarageInteriors[gtype][1],GarageInteriors[gtype][2]);
lastGarage[playerid] = i;
}
else
{
new vid = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(vid,floatround(GarageInteriors[gtype][4]));
SetVehicleVirtualWorld(vid,gInfo[i][UID]);
SetPlayerVirtualWorld(playerid,gInfo[UID]);
SetPlayerInterior(playerid,floatround(GarageInteriors[gtype][4]));
SetVehiclePos(vid,GarageInteriors[gtype][0],GarageInteriors[gtype][1],GarageInteriors[gtype][2]);
lastGarage[playerid] = i;
}
return 1;
}
}
SendClientMessageEx(playerid,COLOR_ERROR,"No estбs cerca de un garage. ");
return 1;
}