Carlock problem
#1

Hello!

I have a problem with my carlock system. If you lock the car and a new player connect to the server, or
you drive a litte around the car is unlocked for other players.

Код:
else if (strcmp("/carlock", cmd, true, 10) == 0)
    {
        if (Carlist[playerid][Typ]!=-1)
        {
            if (Carlist[playerid][Carid]!=-1)
            {
                if (Carlist[playerid][Lock]==0)
                {
                    Carlist[playerid][Lock]=1;
                    CarLocked[carid]=1;
                    SetVehicleParamsForAll(Carlist[playerid][Carid],0,1);
                    PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                    GameTextForPlayer(playerid, "~w~Fahrzeug ~r~Abgeschlossen", 5000, 6);
                }
                else
                {
                    Carlist[playerid][Lock]=0;
                    CarLocked[carid]=0;
                    SetVehicleParamsForAll(Carlist[playerid][Carid],0,0);
                    PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                    GameTextForPlayer(playerid, "~w~Fahrzeug ~g~Aufgeschlossen", 5000, 6);
                }
            }
            else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt zur Zeit kein Auto!"); }
        }
        else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Auto!"); }
        return 1;
    }
I know that onvehicle stram in is missing.. i tryed a lot but nothing worked yet.

I hope someone can help me

Best regards
Reply
#2

It's https://sampwiki.blast.hk/wiki/SetVehicleParamsEx.
Reply
#3

Thanks for your answer, but i don't know how i do it..
Reply
#4

your version
pawn Код:
else if (strcmp("/carlock", cmd, true, 10) == 0)
    {
        if (Carlist[playerid][Typ]!=-1)
        {
            if (Carlist[playerid][Carid]!=-1)
            {
                if (Carlist[playerid][Lock]==0)
                {
                    Carlist[playerid][Lock]=1;
                    CarLocked[carid]=1;
                    SetVehicleParamsForAll(Carlist[playerid][Carid],0,1); // there is no such a fuction :\
                    PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                    GameTextForPlayer(playerid, "~w~Fahrzeug ~r~Abgeschlossen", 5000, 6);
                }
                else
                {
                    Carlist[playerid][Lock]=0;
                    CarLocked[carid]=0;
                    SetVehicleParamsForAll(Carlist[playerid][Carid],0,0);
                    PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                    GameTextForPlayer(playerid, "~w~Fahrzeug ~g~Aufgeschlossen", 5000, 6);
                }
            }
            else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt zur Zeit kein Auto!"); }
        }
        else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Auto!"); }
        return 1;
    }


my version :
pawn Код:
else if (strcmp("/carlock", cmd, true, 10) == 0)
{
    if (Carlist[playerid][Typ]!=-1) {
        if (Carlist[playerid][Carid]!=-1) {
            if (Carlist[playerid][Lock]==0) {
                Carlist[playerid][Lock]=1;
                CarLocked[carid]=1;
                for(new i=0; i < MAX_PLAYERS; i++) {
                    if(i == playerid) continue;
                    //SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked);
                    SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,0,1);// i = All
                }

                PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~Fahrzeug ~r~Abgeschlossen", 5000, 6);
            }
            else {
                Carlist[playerid][Lock]=0;
                CarLocked[carid]=0;
                SetVehicleParamsForAll(Carlist[playerid][Carid],0,0);
                PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~Fahrzeug ~g~Aufgeschlossen", 5000, 6);
            }
        }
        else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt zur Zeit kein Auto!"); }
    }
    else { SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Auto!"); }
    return 1;
}
Reply
#5

Thanks, but SetVehicleParams is still missing. The Public and the forward etc.....
Reply
#6

Quote:
Originally Posted by Kalli749
Посмотреть сообщение
Thanks, but SetVehicleParams is still missing. The Public and the forward etc.....
what do you mean?
Reply
#7

Quote:
Originally Posted by Kalli749
Посмотреть сообщение
Thanks, but SetVehicleParams is still missing. The Public and the forward etc.....
You dont need to forward it or anything... its a native command/function.
Reply
#8

Ok...

But if i lock the vehicle at LSPD so all players at lspd can't get in my car. But if i drive so LS Pier the car is unlocked for players standing there. So they can get in my car.
Reply
#9

Quote:
Originally Posted by Kalli749
Посмотреть сообщение
Ok...

But if i lock the vehicle at LSPD so all players at lspd can't get in my car. But if i drive so LS Pier the car is unlocked for players standing there. So they can get in my car.
Read what varth said....
use https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Reply
#10

Quote:
Originally Posted by Kalli749
Посмотреть сообщение
Ok...

But if i lock the vehicle at LSPD so all players at lspd can't get in my car. But if i drive so LS Pier the car is unlocked for players standing there. So they can get in my car.
what do you mean? o.0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)