Problem with vehicle spawning
#1

This is really annoying me now..

Basically, I have a player vehicle system and they can storage the vehicle's and unstorage them - I have tested to see if there's a problem with vehicle ID's, I made it print the ID of the vehicle's(they were different)

This is my code for when the player enter's a vehicle. (it show's the right name for the vehicle and only shows if THEY own it, this code works)
pawn Код:
for(new v; v < MAX_PLAYER_VEHICLES; v++) {
            if(playerVehicles[playerid][v][cOwner] == playerid && playerVehicles[playerid][v][cID] == GetPlayerVehicleID(playerid)) {
                format(string, sizeof(string), "You are the owner of this %s! (/help vehicles)", VehicleName[playerVehicles[playerid][v][cModelID] - 400]);
                SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
                break;
            }
        }
Now, I have the /parkcar command to park the vehicle. (update the position)
pawn Код:
CMD:parkcar(playerid)
{
    new Float: x, Float: y, Float: z;
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be inside a vehicle to use this!");
    else {
        for(new v; v < MAX_PLAYER_VEHICLES; v++) {
            if(playerVehicles[playerid][v][cOwner] == playerid && playerVehicles[playerid][v][cID] == GetPlayerVehicleID(playerid)) {
                SendClientMessage(playerid, COLOR_WHITE, "Parking your vehicle.. (please wait 3 seconds)");
                GetPlayerPos(playerid, x, y, z);
                SetTimerEx("parkingVeh", 3000, false, "ufff", playerid, x, y, z);
                break;
            }
            else SendClientMessage(playerid, COLOR_GREY, "You need to own the vehicle you wish to park."); break;
        }
    }
    return 1;
}
This works but only for the vehicle that is in slot 0(I.E. the first car, as there is 8 vehicle slots)
If I try doing it in my vehicle slot 4 for EG it will say I need to own the vehicle to park it, sorry for all this, I am really stuck on this.

Thanks
Reply
#2

Somebody help him :O
Reply
#3

lol please do
Reply
#4

xD Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)