[CRITICAL] Issue w/ Vehicles [+Rep]
#1

Hey there guys,

I have encountered a very serious situation that leaves me completely clueless after over seven hours of trying to fix this situation. My situation is that when a player enters a player-owned vehicle they cannot start the engine due to there being no fuel, even though there should be 100% fuel. After further investigating I found that the variables were loading successfully; however would reset for some reason?

I had it print a message when a player vehicle spawned, stating the ID (of the player spawned vehicle) and it gave the correct value, I then put it under a command (CMD:engine) and it stated that the ID was an incorrect value (0), which made the server read it as a faction vehicle or admin spawned vehicle.

I will seriously appreciate anyone who can aid me in finding the solution and I will be more than happy to provide reputation. The code involving the player ownership is below. I really need to fix this soon, as my custom gamemode is stuck until I can manage to fix this system, I have many people waiting on me to finish the script, and I can afford no delays.


pawn Код:
enum playerVehicleInfo
{
    Float: playerVehiclePosition[3],
    Float: playerVehicleRotation,
    Float: playerVehicleGas,
    playerVehicleModel,
    playerVehicleID,
    playerVehicleColor1,
    playerVehicleColor2,
    playerVehicleLocked,
    playerTrunkArmour,
    playerTrunkMoney,
    playerTrunkWeapon1,
    playerTrunkWeapon2,
    playerTrunkWeapon3,
    playerTrunkAmmo1,
    playerTrunkAmmo2,
    playerTrunkAmmo3,
    playerTrunkPot,
    playerTrunkCocaine,
    playerTrunkMedicalKit,
    playerTrunkMaterials,
    playerOwnerID,
    LicensePlate[8],
    playerPlateRespawn,
    playerVehicleSlot,
}

new pvInfo[MAX_VEHICLES][playerVehicleInfo];
pawn Код:
public OnPlayerSpawn(playerid)
{
        initiatePlayerVehicles(playerid);
        return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    DestroyVehicle(pVehicle1[playerid]);
    DestroyVehicle(pVehicle2[playerid]);
    DestroyVehicle(pVehicle3[playerid]);
    return 1;
}
pawn Код:
forward initiatePlayerVehicles(playerid);
public initiatePlayerVehicles(playerid)
{
    format(globalstring, sizeof(globalstring), "SELECT * FROM playervehicles WHERE playerOwnerID = '%d'", pInfo[playerid][pID]);
    mysql_query(globalstring);
    mysql_store_result();
    new x;
    while(mysql_retrieve_row())
    {
        mysql_get_field("playerOwnedVehicleID", result);
        x = strval(result);
        mysql_get_field("playerVehicleSlot", result);
        pvInfo[x][playerVehicleSlot] = strval(result);
        mysql_get_field("playerVehicleModel", result);
        pvInfo[x][playerVehicleModel] = strval(result);
        mysql_get_field("playerVehicleColor1", result);
        pvInfo[x][playerVehicleColor1] = strval(result);
        mysql_get_field("playerVehicleColor2", result);
        pvInfo[x][playerVehicleColor2] = strval(result);
        mysql_get_field("playerVehicleX", result);
        pvInfo[x][playerVehiclePosition][0] = floatstr(result);
        mysql_get_field("playerVehicleY", result);
        pvInfo[x][playerVehiclePosition][1] = floatstr(result);
        mysql_get_field("playerVehicleZ", result);
        pvInfo[x][playerVehiclePosition][2] = floatstr(result);
        mysql_get_field("playerVehicleRot", result);
        pvInfo[x][playerVehicleRotation] = floatstr(result);
        mysql_get_field("playerVehicleGas", result);
        pvInfo[x][playerVehicleGas] = floatstr(result);
        mysql_get_field("playerVehicleLocked", result);
        pvInfo[x][playerVehicleLocked] = strval(result);
        mysql_get_field("playerTrunkArmour", result);
        pvInfo[x][playerTrunkArmour] = strval(result);
        mysql_get_field("playerTrunkCash", result);
        pvInfo[x][playerTrunkMoney] = strval(result);
        mysql_get_field("playerTrunkWeapon1", result);
        pvInfo[x][playerTrunkWeapon1] = strval(result);
        mysql_get_field("playerTrunkWeapon2", result);
        pvInfo[x][playerTrunkWeapon2] = strval(result);
        mysql_get_field("playerTrunkWeapon3", result);
        pvInfo[x][playerTrunkWeapon3] = strval(result);
        mysql_get_field("playerTrunkAmmo1", result);
        pvInfo[x][playerTrunkAmmo1] = strval(result);
        mysql_get_field("playerTrunkAmmo2", result);
        pvInfo[x][playerTrunkAmmo2] = strval(result);
        mysql_get_field("playerTrunkAmmo3", result);
        pvInfo[x][playerTrunkAmmo3]= strval(result);
        mysql_get_field("playerTrunkPot", result);
        pvInfo[x][playerTrunkPot] = strval(result);
        mysql_get_field("playerTrunkCocaine", result);
        pvInfo[x][playerTrunkCocaine] = strval(result);
        mysql_get_field("playerTrunkMedicalKit", result);
        pvInfo[x][playerTrunkMedicalKit] = strval(result);
        mysql_get_field("playerTrunkMaterials", result);
        pvInfo[x][playerTrunkMaterials] = strval(result);
        mysql_get_field("playerOwnerID", result);
        pvInfo[x][playerOwnerID] = strval(result);
        if(!IsValidVehicle(pVehicle1[playerid]) || !IsValidVehicle(pVehicle2[playerid]) || !IsValidVehicle(pVehicle3[playerid]))
        {
            if(pvInfo[x][playerVehicleSlot] == 1)
            {
                if(!IsValidVehicle(pVehicle1[playerid]))
                {
                    pVehicle1[playerid] = CreateVehicle(pvInfo[x][playerVehicleModel], pvInfo[x][playerVehiclePosition][0], pvInfo[x][playerVehiclePosition][1], pvInfo[x][playerVehiclePosition][2], pvInfo[x][playerVehicleRotation], pvInfo[x][playerVehicleColor1], pvInfo[x][playerVehicleColor2], 60000);
                    print("Vehicle one spawned for player!");
                    printf("Vehicle Slot: %d", pvInfo[x][playerVehicleSlot]);
                    SetVehicleToRespawn(pVehicle1[playerid]);
                }
            }
            if(pvInfo[x][playerVehicleSlot] == 2)
            {
                if(!IsValidVehicle(pVehicle2[playerid]))
                {
                    pVehicle2[playerid] = CreateVehicle(pvInfo[x][playerVehicleModel], pvInfo[x][playerVehiclePosition][0], pvInfo[x][playerVehiclePosition][1], pvInfo[x][playerVehiclePosition][2], pvInfo[x][playerVehicleRotation], pvInfo[x][playerVehicleColor1], pvInfo[x][playerVehicleColor2], 60000);
                    print("Vehicle two spawned for player!");
                }
            }
            if(pvInfo[x][playerVehicleSlot] == 3)
            {
                if(!IsValidVehicle(pVehicle3[playerid]))
                {
                    pVehicle3[playerid] = CreateVehicle(pvInfo[x][playerVehicleModel], pvInfo[x][playerVehiclePosition][0], pvInfo[x][playerVehiclePosition][1], pvInfo[x][playerVehiclePosition][2], pvInfo[x][playerVehicleRotation], pvInfo[x][playerVehicleColor1], pvInfo[x][playerVehicleColor2], 60000);
                    print("Vehicle three spawned for player!");
                }
            }
            if(pvInfo[x][playerVehicleLocked] == 1)
            {
                SetVehicleParamsEx(x, engine, lights, alarm, 1, bonnet, boot, objective);
            }
        }
    }
    mysql_free_result();
    return 1;
}
pawn Код:
CMD:engine(playerid,params[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new model = GetVehicleModel(vehicleid);
    GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerDriver(playerid)) return SendClientMessage(playerid, ERROR, "You must be in the driver seat to activite or deactivate the engine!");
    if(vehEngine[vehicleid] == 1)
    {
        format(globalstring,sizeof(globalstring),"%s twists their vehicle's key in the ignition left, turning it off.",RPName(playerid));
        nearByMessage(playerid,COLOR_PURPLE,globalstring);
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        vehEngine[vehicleid] = 0;
        KillTimer(FuelTimerz[playerid]);
    }
    else if(vehEngine[vehicleid] == 0)
    {
        if(vehicleid == pVehicle1[playerid] || vehicleid == pVehicle2[playerid] || vehicleid == pVehicle3[playerid])
        {
            if(pvInfo[playerid][playerVehicleGas] >= 1)
            {
                if(model == 510) return SendClientMessage(playerid, ERROR, "Mountain bikes do not have engines!");
                if(vehEngine[vehicleid] == 0)
                {
                    vehEngine[vehicleid] = 2;
                    SetTimerEx("StartEngine", 1500, 0, "i", playerid);
                    format(globalstring,sizeof(globalstring),"%s twists their vehicle's key in the ignition right, attempting to turn it on.",RPName(playerid));
                    nearByMessage(playerid,COLOR_PURPLE,globalstring);
                }
                else if(vehEngine[vehicleid] == 2)
                {
                    SetTimerEx("StartEngine", 1500, 0, "i", playerid);
                    format(globalstring,sizeof(globalstring),"%s twists their vehicle's key in the ignition right, attempting to turn it on.",RPName(playerid));
                    nearByMessage(playerid,COLOR_PURPLE,globalstring);
                }
            }
            else return SendClientMessage(playerid, ERROR, "This vehicle is out of fuel and the engine cannot be turned on!");
        }
        else if(vInfo[vehicleid][vVehicleScriptID] >= 0)
        {
            if(vInfo[vehicleid][vGasoline] >= 1)
            {
                if(model == 510) return SendClientMessage(playerid, ERROR, "Mountain bikes do not have engines!");
                if(vehEngine[vehicleid] == 0)
                {
                    vehEngine[vehicleid] = 2;
                    SetTimerEx("StartEngine", 1500, 0, "i", playerid);
                    format(globalstring,sizeof(globalstring),"%s twists their vehicle's key in the ignition right, attempting to turn it on.",RPName(playerid));
                    nearByMessage(playerid,COLOR_PURPLE,globalstring);
                }
                else if(vehEngine[vehicleid] == 2)
                {
                    SetTimerEx("StartEngine", 1500, 0, "i", playerid);
                    format(globalstring,sizeof(globalstring),"%s twists their vehicle's key in the ignition right, attempting to turn it on.",RPName(playerid));
                    nearByMessage(playerid,COLOR_PURPLE,globalstring);
                }
            }
            else
            {
                SendClientMessage(playerid, ERROR, "This vehicle is out of fuel and the engine cannot be turned on!");
            }
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid != pVehicle1[playerid] || vehicleid != pVehicle2[playerid] || vehicleid != pVehicle3[playerid])
        {
            if(vInfo[vehicleid][vVehicleScriptID] >= 0)
            {
                return 0;
            }
            else
            {
                if(pInfo[playerid][pHotwiringKit] == 0)
                {
                    SendClientMessage(playerid, ERROR, "You do not have the key to this vehicle, nor can you hotwire it without a hotwiring kit.");
                    RemovePlayerFromVehicle(playerid);
                }
                else
                {
                    SendClientMessage(playerid, 0x6A5FAFFF, "You have a hotwiring kit; use /hotwire to hotwire this vehicle.");
                }
                print("This vehicle is owned!!");
            }
        }
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(vInfo[i][vVehicleScriptID] == GetPlayerVehicleID(playerid) && vInfo[i][vVehicleFaction] != 0 && vInfo[i][vVehicleFaction] != pInfo[playerid][pFaction])
            {
                if(vInfo[i][vFactionRank] > pInfo[playerid][pFactionRank])
                {
                    switch(vInfo[i][vFactionRank])
                    {
                        case 1: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName1]);
                        case 2: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName2]);
                        case 3: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName3]);
                        case 4: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName4]);
                        case 5: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName5]);
                        case 6: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName6]);
                        case 7: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName7]);
                        case 8: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName8]);
                        case 9: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName9]);
                        case 10: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName10]);
                    }
                    SendClientMessage(playerid, ERROR, globalstring);
                }
                else
                {
                    switch(vInfo[i][vFactionRank])
                    {
                        case 1: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName1]);
                        case 2: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName2]);
                        case 3: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName3]);
                        case 4: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName4]);
                        case 5: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName5]);
                        case 6: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName6]);
                        case 7: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName7]);
                        case 8: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName8]);
                        case 9: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName9]);
                        case 10: format(globalstring, sizeof(globalstring), "This vehicle is locked from your usage. [%s - %s and above]", fInfo[vInfo[playerid][vVehicleFaction]][fName], fInfo[vInfo[i][vVehicleFaction]][fRankName10]);
                    }
                    SendClientMessage(playerid, ERROR, globalstring);
                }
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
PHP код:
[17:38:50CMySQLHandler::Query(SELECT FROM playervehicles WHERE playerOwnerID '1') - Successfully executed.
[
17:38:50] >> mysql_store_resultConnection handle)
[
17:38:50CMySQLHandler::StoreResult() - Result was stored.
[
17:38:50] >> mysql_retrieve_rowConnection handle)
[
17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerOwnedVehicleID") - 1
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleSlot") - 1
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleModel") - 402
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleColor1") - 1
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleColor2") - 1
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleX") - 45.3098
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleY") - 1161.1
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleZ") - 18.5693
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleRot") - 360
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleGas") - 100
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerVehicleLocked") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkArmour") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkCash") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkWeapon1") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkWeapon2") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkWeapon3") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:50CMySQLHandler::FetchField("playerTrunkAmmo1") - 0
[17:38:50] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkAmmo2") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkAmmo3") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkPot") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkCocaine") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkMedicalKit") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerTrunkMaterials") - 0
[17:38:51] >> mysql_fetch_field_rowConnection handle)
[
17:38:51CMySQLHandler::FetchField("playerOwnerID") - 1
[17:38:51] >> mysql_retrieve_rowConnection handle)
[
17:38:51] >> mysql_free_resultConnection handle)
[
17:38:51CMySQLHandler::FreeResult() - Result was successfully free'd.
[17:38:51] >> mysql_free_result( Connection handle: 1 )
[17:38:51] CMySQLHandler::FreeResult() - The result is already empty.
[17:39:12] >> mysql_query( Connection handle: 1 ) 
Kind Regards & Best Wishes,
Nmader
Fellow Scripter
Reply
#2

Try that:

Код:
if(pvInfo[playerid][playerVehicleGas] == 0) return SendClientMessage(playerid, ERROR, "This vehicle is out of fuel.");
To prevent that everything is out of place if you forget to open or close brackets { }.
Reply
#3

Quote:
Originally Posted by Baines
Посмотреть сообщение
Try that:

Код:
if(pvInfo[playerid][playerVehicleGas] == 0) return SendClientMessage(playerid, ERROR, "This vehicle is out of fuel.");
To prevent that everything is out of place if you forget to open or close brackets { }.
That would not change anything, I am certain the brackets are in the correct place, variables are somehow resetting, that's the issue I've found.
Reply
#4

Код:
if(vInfo[vehicleid][vVehicleScriptID] >= 0)
Does that mean that the car is either a faction or admin spawned vehicle?
Reply
#5

You can't save the vehicleid to database.

pawn Код:
mysql_get_field("playerOwnedVehicleID", result);
        x = strval(result);
This is a big no-no unless I'm missing something because you didn't provide all the code your vehicleid's will change dynamically when creating/destroying vehicles.
Reply
#6

Uhm, either I'm reading it wrong or the other people in this topic (Replying, I know after coding for hours and hours you can look over something like it, so I don't mean you.) should really stop scripting. But, have you noticed:

pvInfo[ playerid ][playerVehicleGas]

Shouldn't that be the vehicle's ID from the variable/enum? If not so, I wish you luck, I have no clue why you would make a vehicle's gas player-sided...

Best regards,
Jesse
Reply
#7

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
You can't save the vehicleid to database.

pawn Код:
mysql_get_field("playerOwnedVehicleID", result);
        x = strval(result);
This is a big no-no unless I'm missing something because you didn't provide all the code your vehicleid's will change dynamically when creating/destroying vehicles.
The way this is set up is that it loads it in a certain order, thus always providing the same ID, it is just a Auto Incriminating row in the database that holds all the variables.

Quote:
Originally Posted by jessejanssen
Посмотреть сообщение
Uhm, either I'm reading it wrong or the other people in this topic (Replying, I know after coding for hours and hours you can look over something like it, so I don't mean you.) should really stop scripting. But, have you noticed:

pvInfo[ playerid ][playerVehicleGas]

Shouldn't that be the vehicle's ID from the variable/enum? If not so, I wish you luck, I have no clue why you would make a vehicle's gas player-sided...

Best regards,
Jesse
Yeah, it was originally vehicleid when I did it, then I tried putting it in playerid because I was out of ideas, it didn't work with either.
Reply
#8

Ahhh ok, so all the vehicles are pre-created during on GameModeInit ? Then and it simply saves the vehicleid? If that is the case it's a pretty sketchy way to do because removing any vehicle will screw everything up. I am just trying to ascertain exactly how your system works because when I see vehicleid's saving I'm instantly thinking mix up.
Reply
#9

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Ahhh ok, so all the vehicles are pre-created during on GameModeInit ? Then and it simply saves the vehicleid? If that is the case it's a pretty sketchy way to do because removing any vehicle will screw everything up. I am just trying to ascertain exactly how your system works because when I see vehicleid's saving I'm instantly thinking mix up.
It saves an internal ID that never changes, it goes upon the first one that is available, it's an internal ID that can only be changed manually in the system if needed, which won't happen.
Reply
#10

Doesn't really make sense to me if it keeps auto incrementing then eventually you would get an OOB error once your server reaches 2000 vehicles.

new pvInfo[MAX_VEHICLES][playerVehicleInfo];

Or am I missing something here because typically you would assign the reference to pvInfo[] with the id of the vehicle created.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)