SA-MP Forums Archive
Help with my vehicle ownership.. - 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: Help with my vehicle ownership.. (/showthread.php?tid=312129)



Help with my vehicle ownership.. - Azzeto - 20.01.2012

Hey, I'm getting a small error with my vehicle ownership..

pawn Код:
dealercar[0] = CreateVehicle(494,-1989.09997559,274.50000000,35.09999847,266.00000000,-1,-1,15); //Hotring
    dealercar[1] = CreateVehicle(415,-1989.90002441,268.79998779,35.00000000,266.00000000,-1,-1,15); //Cheetah
    dealercar[2] = CreateVehicle(429,-1990.19995117,263.20001221,34.90000153,266.00000000,-1,-1,15); //Banshee
    dealercar[3] = CreateVehicle(541,-1990.80004883,258.10000610,34.90000153,264.00000000,-1,-1,15); //Bullet
    dealercar[4] = CreateVehicle(402,-1991.00000000,253.10000610,35.09999847,264.00000000,-1,-1,15); //Buffalo
    dealercar[5] = CreateVehicle(477,-1992.59997559,241.69999695,35.00000000,266.00000000,-1,-1,15); //ZR-350
    dealercar[6] = CreateVehicle(555,-1991.80004883,247.00000000,35.00000000,266.00000000,-1,-1,15); //Windsor
    dealercar[7] = CreateVehicle(521,-1989.40002441,299.89999390,34.79999924,270.00000000,-1,-1,15); //FCR-900
    dealercar[8] = CreateVehicle(522,-1989.40002441,302.39999390,34.79999924,270.00000000,-1,-1,15); //NRG-500
    dealercar[9] = CreateVehicle(463,-1989.30004883,304.60000610,34.79999924,270.00000000,-1,-1,15); //Freeway
    dealercar[10] = CreateVehicle(586,-1989.30004883,306.39999390,34.79999924,270.00000000,-1,-1,15); //Wayfarer
    dealercar[11] = CreateVehicle(461,-1989.50000000,308.60000610,34.90000153,274.00000000,-1,-1,15); //PCJ-600
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        new car = GetPlayerVehicleID(playerid);
        if(car == dealercar[0] || car == dealercar[1] || car == dealercar[2] || car == dealercar[3] || car == dealercar[4] || car == dealercar[5] || car == dealercar[6] || car == dealercar[7] || car == dealercar[8] || car == dealercar[9] || car == dealercar[10] || car == dealercar[11])
        {
            TogglePlayerControllable(playerid,0);
            SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"This vehicle is owned by the dealership.");
            SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"If you wish to purchase this vehicle then use /buycar");
            SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"If you wish not to purchase this vehicle, then /exitcar");
        }
    }
Quote:

CMD:buycar(playerid,params[])
{
new car = GetPlayerVehicleID(playerid);
if(car == dealercar[0] || car == dealercar[1] || car == dealercar[2] || car == dealercar[3] || car == dealercar[4] || car == dealercar[5] || car == dealercar[6] || car == dealercar[7] || car == dealercar[8] || car == dealercar[9] || car == dealercar[10] || car == dealercar[11])
{
PlayerInfo[playerid][Vehicle] = car;
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a vehicle.");
}
return 1;
}
CMD:exitcar(playerid,params[])
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,1);
SetTimer("Unfreeze",1500,0);
return 1;
}
CMD:mycar(playerid,params[])
{
new Floatp[3];
new vehicle = GetPlayerVehicleID(playerid);
if(CARSPAWNED[playerid] == 0)
{
GetPlayerPos(playerid,pp[0],pp[1],pp[2]);
CreateVehicle(PlayerInfo[playerid][Vehicle],pp[0],pp[1],pp[2],0,-1,-1,0);
SendClientMessage(playerid,-1,EMBED_YELLOW"[VEHICLE]: "EMBED_WHITE"You've spawned your vehicle.");
}
else if(CARSPAWNED[playerid] == 1)
{
DestroyVehicle(vehicle);
}
return 1;
}

These are my commands and crap.. Now when I do /mycar my car doesn't spawn.. and I dont think the variable gets set to the car id there in..