Jump to content
  • 0

SetVehicleParamsForPlayer (bug )


Rayan

Question

Am o problema cu aceasta functie.

Am o comanda /lock, si cand o folosesc, trebuie sa incuie pentru toti jucatorii usile (masina sa fie locked), iar pentru mine sa fie deschisa.

CMD:lock(playerid, params[])
{
        new vehicleid = user_vehicle[playerid];
        foreach(new i : Player) {
                if(i != playerid) SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
        }
        SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
        return 1;
}

Totul merge ok, nimeni nu poate intra in masina, insa daca eu sunt detinatorul la masina, si ma urc in ea, dupa toti vor putea sa dea F, tinand cont ca am setat deja parametirii sa fie 1 (1 = locked).. si doar 0 (unlocked) pentru detinator (adica doar pentru mine)..

Iar la OnVehicleStreamIn am asta:

public OnVehicleStreamIn(vehicleid, forplayerid)
{

     if(is_vehicle_personal[vehicleid] == 1)
     {

            if(!strcmp(vehicle_owner[vehicleid], PlayerInfo[forplayerid][pNormalName], true)) SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 0); // unlocked
            else SetVehicleParamsForPlayer(vehvicleid, forplayerid, 0, 1); // locked because is not the  owner
     }
     return 1;
}

 

Nu inteleg unde e problema, am facut si un debug la functia SetVehicleParamsForPlayer si ce a iesit a fost asta:

[16:45:56] SetVehicleParamsForPlayer(368,1,0,1)

[16:45:56] SetVehicleParamsForPlayer(368,0,0,0)

[16:45:56] SetVehicleParamsForPlayer(368,1,0,1)

[16:45:56] SetVehicleParamsForPlayer(368,1,0,1)

[16:45:57] SetVehicleParamsForPlayer(368,0,0,0)

[16:45:57] SetVehicleParamsForPlayer(368,0,0,0)

1 == cel ce nu detinator
0 == jucatorul care detine masina 368

Totul merge ok, la /lock si la OnVehicleStreamIn sunt chemate si executate ok comenzile, insa cand owneru masinii se urca in ea, practic se deblocheaza pentru toti, iar functia SetVehicleParamsForPlayer  nu e chemata (daca era chemata stiam ca e de la functia), chiar nu stiu unde e problema..

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Salut, daca ai verificat si esti sigur ca atunci cand proprietarul urca in masina se descuie atunci verifici la onplayerentervehicle si onplayerstatechange -> newstate -> player state driver

unde este o verificare ca playerid este proprietarul masinii si sa verific ce e in neregula daca este vreo functie de unlock sau direct functia vehicleparams

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
Acum 16 ore, Mister a spus:

Salut, daca ai verificat si esti sigur ca atunci cand proprietarul urca in masina se descuie atunci verifici la onplayerentervehicle si onplayerstatechange -> newstate -> player state driver

unde este o verificare ca playerid este proprietarul masinii si sa verific ce e in neregula daca este vreo functie de unlock sau direct functia vehicleparams

Mda, din cate vad problema e atunci cand ii dau /engine.

new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
vehEngine[vehicleid] = 1;

 

si

new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
vehEngine[vehicleid] = 0;

 

Doar atunci problema apare.. Vreo rezolvare? 

Am citit ceva pe wiki si cica nu prea se plac SetVehicleParamsForPlayer cu SetVehicleParamsEx, insa n-am idee de o rezolvare. Daca ai una..

Edited by Rayan
Link to comment
Share on other sites

  • 0

Uhm. Incearca sa faci un print cu informatiile despre usi preluate de GetVehicleParamsEx si vezi ce valoare are poate pe undeva pe drum se reseteaza. 

Daca totusi valoarea este corecta(incuiate) incearca sa faci un tweak(setezi dinou valoarea usilor pentru toti playeri). Sau poti seta manual valoarea usilor in SetVehicleParamsEx la engine daca ai o variabila care tine cont daca usile sunt sau nu incuiate

Edited by Banditul
Link to comment
Share on other sites

  • 0
Acum 9 minute, Banditul a spus:

Uhm. Incearca sa faci un print cu informatiile despre usi preluate de GetVehicleParamsEx si vezi ce valoare are poate pe undeva pe drum se reseteaza. 

Daca totusi valoarea este corecta(incuiate) incearca sa faci un tweak(setezi dinou valoarea usilor pentru toti playeri). Sau poti seta manual valoarea usilor in SetVehicleParamsEx la engine daca ai o variabila care tine cont daca usile sunt sau nu incuiate

Din cate se pare, problema e la fixes.inc, l-am scos si acum merge totu perfect, deci nu era de la faptul ca foloseam si SetVehicleParamsEx..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.