/enter that brings you in the car if in a car, or on foot if on foot. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /enter that brings you in the car if in a car, or on foot if on foot. (
/showthread.php?tid=177160)
/enter that brings you in the car if in a car, or on foot if on foot. -
Garc1a - 16.09.2010
I have a teleport command:
pawn Код:
}
if(strcmp(cmd, "/entersd", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5, 1803.1401,-1727.0227,13.5393))
{
if(gTeam[playerid] == 5)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 1803.3407,-1715.1450,13.5341);
SetPlayerPos(playerid, 1803.3407,-1715.1450,13.5341);
SendClientMessage(playerid, COLOR_GREY, "Welcome to the SASD HQ, /exitsd to leave.");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not SASD.");
return 1;
}
}
}
Except it send you with the car and you end up on top of it, as I have SetPlayerPos as well as SetVehiclePos.
I originally only had SetVehiclePos but people on foot couldn't do the command.
How do I make it so that if player is in a vehicle, it does SetVehiclePos, if on foot, SetPlayerPos.
Re: /enter that brings you in the car if in a car, or on foot if on foot. -
CAR - 16.09.2010
Change this
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 1803.3407,-1715.1450,13.5341);
SetPlayerPos(playerid, 1803.3407,-1715.1450,13.5341);
To this:
pawn Код:
if(IsPlayerInAnyVehicle(playerid)) {
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 1803.3407,-1715.1450,13.5341);
} else {
SetPlayerPos(playerid, 1803.3407,-1715.1450,13.5341);
}
Re: /enter that brings you in the car if in a car, or on foot if on foot. -
[XST]O_x - 16.09.2010
pawn Код:
if(strcmp(cmd, "/entersd", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5, 1803.1401,-1727.0227,13.5393))
{
if(gTeam[playerid] == 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 1803.3407,-1715.1450,13.5341);
SendClientMessage(playerid, COLOR_GREY, "Welcome to the SASD HQ, /exitsd to leave.");
return 1;
}
else
{
SetPlayerPos(playerid,1803.3407,-1715.1450,13.5341);
SendClientMessage(playerid, COLOR_GREY, "Welcome to the SASD HQ, /exitsd to leave.");
return 1;
}
}
else return SendClientMessage(playerid,COLOR_GREY,"You are not SASD.");
}
return 1;
}