SA-MP Forums Archive
Vehicle Move Command Glitching - 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: Vehicle Move Command Glitching (/showthread.php?tid=387736)



Vehicle Move Command Glitching - Robert_Crawford - 26.10.2012

So the command is supposed to move a vehicle where you move it to. Well it doesn't it spawn you next to another car that is way away.

pawn Код:
CMD:vmove(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 4) {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You must be inside the vehicle that you wish to move.");

        new
            string[42];

        for(new x = 0; x < MAX_VEHICLES; x++) {
            if(vehicleVariables[x][vVehicleScriptID] == GetPlayerVehicleID(playerid)) {

                GetVehiclePos(x, vehicleVariables[x][vVehiclePosition][0], vehicleVariables[x][vVehiclePosition][1], vehicleVariables[x][vVehiclePosition][2]);
                GetVehicleZAngle(x, vehicleVariables[x][vVehicleRotation]);

                DestroyVehicle(vehicleVariables[x][vVehicleScriptID]);
                vehicleVariables[x][vVehicleScriptID] = CreateVehicle(vehicleVariables[x][vVehicleModelID], vehicleVariables[x][vVehiclePosition][0], vehicleVariables[x][vVehiclePosition][1], vehicleVariables[x][vVehiclePosition][2], vehicleVariables[x][vVehicleRotation], vehicleVariables[x][vVehicleColour][0], vehicleVariables[x][vVehicleColour][1], 60000);
                PutPlayerInVehicle(playerid, vehicleVariables[x][vVehicleScriptID], 0);

                saveVehicle(x);

                format(string, sizeof(string), "You have successfully moved vehicle %d.", x);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
        }
    }
    return 1;
}



Re: Vehicle Move Command Glitching - Robert_Crawford - 26.10.2012

Bump