Teleport to owner car problem - 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: Teleport to owner car problem (
/showthread.php?tid=516512)
Teleport to owner car problem -
Shazwan - 31.05.2014
I got a problem about the teleport to owner car, example going to teleport to our car but it goes to someone else car.
Is there any bug?
Код:
CMD:mycars(playerid, params[])
{
new vstring[1024];
for(new i, iModelID; i < MAX_PLAYERVEHICLES; i++) {
if((iModelID = PlayerVehicleInfo[playerid][i][pvModelId] - 400) >= 0) {
if(PlayerVehicleInfo[playerid][i][pvImpounded]) {
format(vstring, sizeof(vstring), "%s\n%s (impounded)", vstring, VehicleName[iModelID]);
}
else format(vstring, sizeof(vstring), "%s\n%s", vstring, VehicleName[iModelID]);
}
else strcat(vstring, "\nEmpty Slot");
}
ShowPlayerDialog(playerid, MYCAR, DIALOG_STYLE_LIST, "Player Vehicle", vstring, "Teleport", "Cancel");
return 1;
}
and heres the dialog look's ok to me i think
Код:
if(dialogid == MYCAR)
{
if(response == 1)
{
for(new i = 0; i < MAX_PLAYERVEHICLES; i++)
{
if(listitem == i)
{
new Float: carPos[3], id = GetPVarInt(playerid, "playeraffectedcarTP");
if(PlayerVehicleInfo[playerid][i][pvId] > INVALID_PLAYER_VEHICLE_ID)
{
GetVehiclePos(PlayerVehicleInfo[playerid][i][pvId], carPos[0], carPos[1], carPos[2]);
SetPlayerVirtualWorld(playerid,GetVehicleVirtualWorld(PlayerVehicleInfo[playerid][i][pvId]));
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid, carPos[0], carPos[1], carPos[2]);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can not teleport to a empty/impounded slot.");
}
}
}
}
}
Re: Teleport to owner car problem -
Aerotactics - 31.05.2014
Change these lines:
pawn Код:
new iModelID;
for(new i; i < MAX_PLAYERVEHICLES; i++) {
if((iModelID = PlayerVehicleInfo[i][pvModelId] - 400) >= 0) {
if(PlayerVehicleInfo[i][pvImpounded]) {