[Help] two vehicle one same id
#1



need help here, what makes the vehicles have same id ?

if image doesnt show :
https://www.dropbox.com/s/3pis5jfr50n2hci/sa-mp-000.png
Reply
#2

Image doesn't display. Why on earth are you using ******** to show images..? www.imgur.com
Reply
#3

sure its re uploaded, but its showing to me..
Reply
#4

Image:
Reply
#5

why you reposted my image ? i've re- uploaded it ..
Reply
#6

Show us the code that brings the message to the player.
Reply
#7

pawn Код:
foreach(Player, i) {
        for(new c=0; c<MAX_PLAYER_VEHICLE; c++){
            if(playerVariables[i][pCarID][c] == vehicleid) {
                if(playerVariables[playerid][pAdminLevel] >= 1 && playerVariables[playerid][pAdminDuty] >= 1) {
                    SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
                    GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME);
                    format(szMessage, sizeof(szMessage), "This %s (model %d, ID %d) is owned by %s.", VehicleNames[playerVariables[i][pCarModel][c] - 400], playerVariables[i][pCarModel][c], playerVariables[i][pCarID][c], GetPlayerNameEx(i));
                    SendClientMessage(playerid, COLOR_GREY, szMessage);
                }
                else if(playerVariables[i][pCarLock][c] == 1) {
                    RemovePlayerFromVehicle(playerid);
                    new Float:slx, Float:sly, Float:slz;
                    GetPlayerPos(playerid, slx, sly, slz);
                    SetPlayerPos(playerid, slx, sly, slz);
                    SendClientMessageEx(playerid, COLOR_LIGHTRED, "Kendaraan ini dikunci!");
                }
            }
        }
    }
its just check every vehicle thats the player vehicle id is the same with, then its show its owner info..
its on OnPlayerEnterVehicle
Reply
#8

U shud be using that under onplayertatechange, not under onplayerentervehicle for a start. I'd suspect that there is an issue with the player not yet being in te vehicle in question.
Reply
#9

but when the player use cmd /findcar (its show the player vehicle location), its showing the vehicle thats owned by other player not the players vehicle, which is the vhicle have ID 88..
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
The two vehicles don't have the same ID, the problem is probably this variable:

pawn Код:
playerVariables[i][pCarID][c]
Two of those have the same ID, that's a different thing entirely.
pawn Код:
playerVariables[i][pCarID][c]
that var is the return value of the vehicle id from this :

pawn Код:
stock SpawnPlayerVehicle(playerid,slot) {
    if(playerVariables[playerid][pCarModel][slot] >= 1) {
        if(systemVariables[vehicleCounts][0] + systemVariables[vehicleCounts][1] + systemVariables[vehicleCounts][2] < MAX_VEHICLES) {
            DestroyVehicle(playerVariables[playerid][pCarID][slot]); // In case the IDs decide to f*$^# up.
            playerVariables[playerid][pCarID][slot] = CreateVehicle(playerVariables[playerid][pCarModel][slot], playerVariables[playerid][pCarPosX][slot], playerVariables[playerid][pCarPosY][slot], playerVariables[playerid][pCarPosZ][slot], playerVariables[playerid][pCarPosZAngle][slot], playerVariables[playerid][pCarColour1][slot], playerVariables[playerid][pCarColour2][slot], -1);

            #if defined DEBUG
                printf("[debug] SpawnPlayerVehicle(%d, %d, %d)", playerid, slot, playerVariables[playerid][pCarID][slot]);
            #endif
            for(new i = 0; i < 14; i++) {
                if(playerVariables[playerid][pCarMods1][i] >= 1) AddVehicleComponent(playerVariables[playerid][pCarID][0], playerVariables[playerid][pCarMods1][i]);
                if(playerVariables[playerid][pCarMods2][i] >= 1) AddVehicleComponent(playerVariables[playerid][pCarID][1], playerVariables[playerid][pCarMods2][i]);
                if(playerVariables[playerid][pCarMods3][i] >= 1) AddVehicleComponent(playerVariables[playerid][pCarID][2], playerVariables[playerid][pCarMods3][i]);
                if(playerVariables[playerid][pCarMods4][i] >= 1) AddVehicleComponent(playerVariables[playerid][pCarID][3], playerVariables[playerid][pCarMods4][i]);
                if(playerVariables[playerid][pCarMods5][i] >= 1) AddVehicleComponent(playerVariables[playerid][pCarID][4], playerVariables[playerid][pCarMods5][i]);
            }
            if(playerVariables[playerid][pCarPaintjob][slot] >= 0) ChangeVehiclePaintjob(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarPaintjob][slot]);
            systemVariables[vehicleCounts][1]++;
            if(slot == 0) SetVehicleNumberPlate(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarLicensePlate1]);
            else if(slot == 1) SetVehicleNumberPlate(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarLicensePlate2]);
            else if(slot == 2) SetVehicleNumberPlate(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarLicensePlate3]);
            else if(slot == 3) SetVehicleNumberPlate(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarLicensePlate4]);
            else if(slot == 4) SetVehicleNumberPlate(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarLicensePlate5]);
           
            vehEngineStat[playerVariables[playerid][pCarID][slot]] = 0;
            VehicleFuel[playerVariables[playerid][pCarID][slot]] = playerVariables[playerid][pCarFuel][slot];
            if(playerVariables[playerid][pCarHp][slot] < 250) SetVehicleHealth(playerVariables[playerid][pCarID][slot], 253);
            else SetVehicleHealth(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarHp][slot]);
           
            UpdateVehicleDamageStatus(playerVariables[playerid][pCarID][slot], playerVariables[playerid][pCarPanels][slot], playerVariables[playerid][pCarDoors][slot], playerVariables[playerid][pCarLights][slot], playerVariables[playerid][pCarTires][slot]);
            // De-stream the vehicle
            SetVehicleVirtualWorld(playerVariables[playerid][pCarID][slot], GetVehicleVirtualWorld(playerVariables[playerid][pCarID][slot])+1);
            SetVehicleVirtualWorld(playerVariables[playerid][pCarID][slot], GetVehicleVirtualWorld(playerVariables[playerid][pCarID][slot])-1);
        }
        else printf("ERROR: Vehicle limit reached (MODEL %d, PLAYER %d, MAXIMUM %d, TYPE PLAYER) [01x08]", playerVariables[playerid][pCarModel][slot], playerid, MAX_VEHICLES);
    }
    return 1;
}
is there something wrong with this ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)