SA-MP Forums Archive
Problem with vehicle spawning - 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: Problem with vehicle spawning (/showthread.php?tid=402480)



Problem with vehicle spawning - MattSlater - 26.12.2012

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


Re: Problem with vehicle spawning - Mafioso97 - 26.12.2012

Somebody help him :O


Re: Problem with vehicle spawning - MattSlater - 26.12.2012

lol please do


Re: Problem with vehicle spawning - Mafioso97 - 27.12.2012

xD Bump