[POMOC] Car Lock Bug [GF]

Započeo GloomY, Jul 09, 2010, 20:09:36 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Znate li možda kako mogu riješiti onaj bug u Godfatheru sa /lock?
Kad se auto zaključa, automatski se nakon nekog vremena otključa?
Ovaj bug je dosta poznat i nisam nigdje našao odgovor kako ga riješiti.

Ako možete pomoći, bit ću vam jako zahvalan.
Poslednja Izmena: Avgust 22, 2010, 21:43:25 POSLE PODNE od [BP] AleeN ba! ^^

1. nije bug, vec je Godfather pravljen u vrijeme kada nisu vozila bila streamana od strane servera te se nije racunalo na OnVehicleStreamIn i Out
2. taj problem lagano mozes rijesiti tako da pod callbackom OnVehicleStreamIn provjeris varijablu za lock i ako je slucajno 1 zakljucas vozilo za igraca.

nemogu se tocno sjetiti kako se zove ta varijabla u GFu ali funkcija kojom kljucas je SetVehicleParamsForPlayer

black_dota

OMG  ??? ??? ??? ??? ??? ??? jes ti normalan to nije bug moras promeniti u tvog gm to da bude stalno zakljucan a ako imas auto u vechicle ownership onda je zauvek zakljucan.

Evo, ovako mi izgleda sada

public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(gCarLock[vehicleid] == 1)
{
   SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
}
return 1;
}


Nisam te baš dobro razumio, što treba dodati pod komandu /lock.
Pokušavao sam dodavanjem ovoga
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,1);
Ali opet isti problem...

Ovako mi izgleda cijela /lock komanda
if(strcmp(cmd, "/lock", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
new carid;
if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
{
if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPhousekey]+1)
{
if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] != 299)
{
gLastDriver[HireCar[playerid]] = 300;
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
}
HireCar[playerid] = gLastCar[playerid];
}
}
if (PlayerInfo[playerid][pPhousekey] == 255)
{
if(HireCar[playerid] == 299)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
}
carid = PlayerInfo[playerid][pPhousekey]+1;
if(HireCar[playerid] != 299 && !SwitchKey[playerid])
{
carid = HireCar[playerid];
}
//new driver = gLastDriver[carid];
new lockstatus = gCarLock[carid];
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(carid, cx, cy, cz);
switch (lockstatus)
{
case 0:
{
if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Iznajmljeno vozilo ~r~Zakljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,1);
LockCar(carid);
}
else if (PlayerInfo[playerid][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~Kucno vozilo ~r~Zakljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,1);
LockCar(carid);
return 1;
}
}
case 1:
{
if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Iznajmljeno vozilo ~g~Otkljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,0);
UnLockCar(carid);
}
if (PlayerInfo[playerid][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~Kucno vozilo ~g~Otkljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),playerid,0,0);
UnLockCar(carid);
return 1;
}
}
default:
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
}
}
if(carid == 256)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
}
}
return 1;
}


I mislim da misliš na ovu varijablu
gCarLock[carid] = 1;
Poslednja Izmena: Jul 10, 2010, 00:06:19 PRE PODNE od Mijau

Nez

*

Citat: black_dota poslato Jul 09, 2010, 23:11:29 POSLE PODNE
OMG  ??? ??? ??? ??? ??? ??? jes ti normalan to nije bug moras promeniti u tvog gm to da bude stalno zakljucan a ako imas auto u vechicle ownership onda je zauvek zakljucan.
jesi li ozbiljan ili zajebavas?

kao sto je john napisao


public OnVehicleStreamIn(vehicleid, forplayerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gCarLock[vehicleid] != -1 && gCarLock[vehicleid] != forplayerid)
        {
            SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
        }
    }
    return 1;
}
uozbiljite se :(


Citat: Nez poslato Jul 10, 2010, 00:39:58 PRE PODNE
Citat: black_dota poslato Jul 09, 2010, 23:11:29 POSLE PODNE
OMG  ??? ??? ??? ??? ??? ??? jes ti normalan to nije bug moras promeniti u tvog gm to da bude stalno zakljucan a ako imas auto u vechicle ownership onda je zauvek zakljucan.
jesi li ozbiljan ili zajebavas?

kao sto je john napisao


public OnVehicleStreamIn(vehicleid, forplayerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gCarLock[vehicleid] != -1 && gCarLock[vehicleid] != forplayerid)
        {
            SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
        }
    }
    return 1;
}


Malo bolje baci pogled da ovo "i" iz loopa ne koristis nigdje  ;)

A da se vratimo na problem, u principu ovo:

public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(gCarLock[vehicleid] == 1)
{
    SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
}
return 1;
}


bi trebalo raditi, ALI baci pogled u mod otkud ti pocinje gcar lock, od prvog vozila ili od 28 (bezveze broj) jer onda bi trebao namjestiti offset znaci npr gCarLock[vehicleid - 28] == 1.

A druga caka je da OnVehicleStreamIn tek profunkcionira kada ti se vozilo unloada i opet loada znaci odmaknes se i priblizis opet.

Treca stvar svaki ovaj GetPlayerVehicleID(playerid) sto si dodao komonto zamjeni sa carid

Evo, ovdje mi počinje
for(new i = 0; i < 35; i++)
{
if(gCarLock[i] == 0)
{
    gCarLock[i] = 1;
}
}
// Car Spawns
for(new h = 0; h < sizeof(HouseInfo); h++)
{
AddStaticVehicleEx(HouseInfo[h][hVec], HouseCarSpawns[h][0], HouseCarSpawns[h][1], HouseCarSpawns[h][2], HouseCarSpawns[h][3], HouseInfo[h][hVcol1], HouseInfo[h][hVcol2], 60000);
gCarLock[h+1] = 1;
}//34


A ovo dolje sam sada izmjenio ovako, pod /lock
SetVehicleParamsForPlayer(carid,playerid,0,1);

Cijela /lock komanda mi sada izgleda ovako:
if(strcmp(cmd, "/lock", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
new carid;
if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
{
if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPhousekey]+1)
{
if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] != 299)
{
gLastDriver[HireCar[playerid]] = 300;
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
}
HireCar[playerid] = gLastCar[playerid];
}
}
if (PlayerInfo[playerid][pPhousekey] == 255)
{
if(HireCar[playerid] == 299)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
}
carid = PlayerInfo[playerid][pPhousekey]+1;
if(HireCar[playerid] != 299 && !SwitchKey[playerid])
{
carid = HireCar[playerid];
}
//new driver = gLastDriver[carid];
new lockstatus = gCarLock[carid];
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(carid, cx, cy, cz);
switch (lockstatus)
{
case 0:
{
if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Iznajmljeno vozilo ~r~Zakljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
SetVehicleParamsForPlayer(carid,playerid,0,1);
LockCar(carid);
}
else if (PlayerInfo[playerid][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~Kucno vozilo ~r~Zakljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
SetVehicleParamsForPlayer(carid,playerid,0,1);
LockCar(carid);
return 1;
}
}
case 1:
{
if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Iznajmljeno vozilo ~g~Otkljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
SetVehicleParamsForPlayer(carid,playerid,0,0);
UnLockCar(carid);
}
if (PlayerInfo[playerid][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~Kucno vozilo ~g~Otkljucano", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
SetVehicleParamsForPlayer(carid,playerid,0,0);
UnLockCar(carid);
return 1;
}
}
default:
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
}
}
if(carid == 256)
{
SendClientMessage(playerid, COLOR_GRAD2, "Nemate automobil!");
}
}
return 1;
}


ZicMortal

I ovo je meni isto problem, sry na refreshu ali pokusavao sam svasta i nejde  :-\


nastoe

Jednostavno napravite novu lock komandu sa drugacijim varijablama i to je to