Garage help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Garage help (
/showthread.php?tid=641010)
Garage help -
iTooTech - 10.09.2017
Ok, so, I am using Classified Gaming Roleplay, and everytime I leave the garage, It sends me to a different location. Any ideas on how to fix it?
Re: Garage help -
Kane - 10.09.2017
You can start by showing us code.
Re: Garage help -
iTooTech - 10.09.2017
Код:
if(strcmp(cmd, "/exitgarage", true) == 0 || strcmp(cmd, "/exitga", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS];
new i = GetPlayerVirtualWorld(playerid), vehicleid;
if(i == 0) return SendClientMessage(playerid, GREY, " You are not inside a garage.");
if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, GREY, " You've been locked inside the garage, tough luck.");
if(IsPlayerInRangeOfPoint(playerid, 30.0, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]) && GetPlayerVirtualWorld(playerid) == i)
{
if(GetPlayerState(playerid) == 2)
{
vehicleid = GetPlayerVehicleID(playerid);
for(new j = 0; j < MAX_PLAYERS; j++)
{
if(IsPlayerInVehicle(j, vehicleid))
{
InCar[j] = vehicleid;
Seat[j] = GetPlayerVehicleSeat(playerid);
SetPlayerInterior(j, 0);
SetPlayerVirtualWorld(j, 0);
SetPVarInt(j, "InGarage", 0);
}
}
SetVehiclePos(vehicleid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
SetVehicleZAngle(vehicleid, GarageInfo[i][GarageExitA]);
SetVehicleWorld(vehicleid, 0);
SetVehicleInterior(vehicleid, 0);
}
SetPlayerPosEx(playerid, GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ]);
SetPlayerFacingAngle(playerid, GarageInfo[i][GarageExitA]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
if(vehicleid != 0)
{
for (new j = 0; j < MAX_PLAYERS; j++)
{
if (InCar[j] == 0) continue;
if (InCar[j] == vehicleid)
{
PutPlayerInVehicle(j, vehicleid, Seat[j]);
}
}
PutPlayerInVehicle(playerid, vehicleid, 0);
}
SetPVarInt(playerid, "InGarage", 0);
return 1;
}
else
{
SendClientMessage(playerid, GREY, " You are not near a garage exit.");
return 1;
}
}
return 1;
}
Re: Garage help -
Kane - 10.09.2017
Your positions set to
GarageInfo[i][GarageExitX], GarageInfo[i][GarageExitY], GarageInfo[i][GarageExitZ] when you exit. If it's random then those positions are incorrectly set.
Re: Garage help -
iTooTech - 10.09.2017
I'm fairly new, could you explain, please?
Re: Garage help -
Kane - 10.09.2017
When you exit, you're teleported to the coordinates stored in GarageExitX, GarageExitY, GarageExitZ.
If you're being teleported to a location that isn't that garages exit then you need to reset the coordinates as it's set to the wrong location.
Re: Garage help -
iTooTech - 10.09.2017
So how do i fix it?
Re: Garage help -
Zeth - 10.09.2017
I think there would be a command such as /editgarage or something to set the exit position of garage. which will store the positions in GarageExitX and Y and Z and A