Car ID problems - 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: Car ID problems (
/showthread.php?tid=366921)
Car ID problems -
MMickey - 08.08.2012
Hy everyone, i got a problem with my cars, First car ID was 1, at /v buy and factions . I try to put the first car ID, 170, but at first server restart, the car ID was 1 and at ''Owner'' say nothing. Then i try to put again the id 1 as the first car id and when i use /v buy command the first car that was in my gamemode disappear. I buy more cars at Dealership, more cars disappear from my gamemode. i try to put again the first id 750 but then disappear the cars from dealership, and of course at server restart appear with id 1 and at ''Owner'' say nothing. Again i try to put the first id as 786 [my last car in my gm] but disappear the car id 785. Down you have some screenshoots, if you don't understand what i write here, [sorry for my bad english, but i'm from Romania]
1. /imageshack/img707/7432/samp049ot.png
2. /imageshack/img825/60/samp050eb.png
3. /imageshack/img819/7365/samp051ua.png
4. /imageshack/img600/2300/samp052qh.png
5. /imageshack/img594/1046/samp054li.png
Here you have what i modified: [with car id as 170]
pawn Код:
public IsAnOwnableCar(carid)
{
for(new i = 170; i < sizeof(ownedcar); i++)
{
if(carid == ownedcar[i]) return 1;
}
return 0;
}
pawn Код:
public LoadCar()
{
new file[26];
for(new idx = 170; idx < sizeof(CarInfo) ; idx++)
{
format(file, sizeof(file),"LARP/Vehicles/%d.ini", idx)
if(dini_Exists(file))
pawn Код:
LoadCar();
new string2[64];
for(new h = 170; h < sizeof(CarInfo); h++)
{
format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h);
if(dini_Exists(string2))
{
ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
if(CarInfo[h][cPaintjob] != 999)
{
ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
}
SetVehicleVirtualWorld(h, CarInfo[h][cVirWorld]);
SetVehicleModifications(h);
}
}
pawn Код:
else if(strcmp(x_nr,"buy",true) == 0)
{
new car = 170;
new model = GetVehicleModel(idcar);
if(IsASalesVehicle(idcar))
{
if(PlayerInfo[playerid][pLevel] < 4)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 4 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You already own 3 cars!");
if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
for(new h = 170; h < sizeof(CarInfo); h++)
{
if(CarInfo[h][cOwned] == 0)
{
car = h;
h = 9999;
}
}
If you don't understand anything please tell me, if i modified something wrong or i don't modified something, and please help..i have a lot of work with this gamemode..but i can't start until i finish this..
this gm is Raven's RP and i modified at this from ianuary ..so..i can't leave it
Again: Sorry for my bad english -_-''
And if i can give some rep++ i give but tell me how..
If someone is from Roumania and don't understand, i translate in romanian
Re: Car ID problems -
Cjgogo - 08.08.2012
Inteleg ce zici,uite cum am facut eu,am definit o variabila care numara toate masinile care nu sunt cumparate(adica le gasesti pe strada),am pus variabila in OnVehicleSpawn,am re-spawnat masinile si am aflat cate masini normale sunt in server,dupa care,am definit variabila la inceput in gamemode:
(x adica cate masini a numarat comanda speciala care am creat-o sa numere),si pe urma am inceput cu i de la 1 pana la cate masini cumparate exista in server,exemplu 2 jucatori cumpara 2 masini,altul cumpara 3 masini,deja exista in server 5 masini cumparate.Am salvat numarul de 5 intr-o fila.Pe urma eu am inceput
de la 1 pana la cate masini sunt in server,si id-ul masinii este,cate masini sunt in server NORMALE
pawn Код:
nrmasini //ala de mai sus ce ti-am explicat
+ 1,la fiecare i,ca creezi o alta masina.Scz mai mult nu pot sa te ajut :P,adica nu pot sa-ti scriu eu codu.Dar din cate vad in poze e destul de avansat,si imi place,deci daca nu ai copiat codu atunci bravo chiar imi place cum arata dealershipu tau(si o sa te prinzi de ce iti explic
).
Re: Car ID problems -
MMickey - 08.08.2012
sincer eu nu prea inteleg ce vrei sa zici adica am inteles partea cu for
si ''din cate vad din poze e destul de avansat'' bugul..? sau..?
la ''cod'' te referi la ce am pus mai sus, sau codul de la dealership..?
eu pe strada am 8 masini [numarate] + 16 [ de la event ] se mai pun si masinile de la factiuni / dealership? daca e asa sunt 785 de masini in total..fara cele care se cumpara
cand ''ai re-spawnat'' ai facut cu /rac..sau cu ce..?
cand spui ca '' am salvat numarul de 5 intr-o fila'' adica trebuie sa fac cv in gen cars.cfg..pe care sa-l pun in scriptfiles..?
la ''pana la cate masini sunt in server'' pot pun MAX_VEHICLES ..?sau pun cum ai zis numarul ''5'' daca sunt 5 masini pe server..? oricum acum dau de fiecare data wipe deci momentan sunt 0 masini..
Merci ca mi-ai raspuns
Re: Car ID problems -
MMickey - 09.08.2012
i just want to solve problem with disappear first cars of gamemode
Re: Car ID problems -
MMickey - 10.08.2012
Help me with this topic..?please..
Re: Car ID problems -
MMickey - 17.08.2012
Someone can read this topic and help me..? please...