Car Lock Help !
#1

Hello everyone, i have bug or i dont know if i can call it BUG but its like this

when i buy a car i upgrade (buy) a lock so when i do /lock it locks ok but when i enter and exit a house/biz/car or respawn or log of it will be unlocked, but i need it when player /lock to be locked all the time, i need it to be unlock only if /lock again or server restart. i need help asap please
Reply
#2

You need to lock the car under OnVehicleStreamIn.

https://sampwiki.blast.hk/wiki/OnVehicleStreamIn
Reply
#3

So that like kinda gonna save it ?
Reply
#4

Vehicles are streamed in SA-MP 0.3 so every time a vehicle appears on players screen you have to lock it again.
Reply
#5

Okay, but you didnt helped me, i need to know where to put it how etc.
Reply
#6

pawn Код:
new VehicleLock[MAX_VEHICLES];
under your /lock command:
pawn Код:
VehicleLock[vehicleid] = 1;
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(VehicleLock[vehicleid] == 1)
    {
        SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by MadeMan
pawn Код:
new VehicleLock[MAX_VEHICLES];
under your /lock command:
pawn Код:
VehicleLock[vehicleid] = 1;
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(VehicleLock[vehicleid] == 1)
    {
        SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
    }
    return 1;
}
i already have car lock command its also for the biz and houses etc,

Код:
//-------------------------[Lock]-----------------------------------------------
if(strcmp(cmd, "/lock", true) == 0)
{
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (PlayerToPoint(3, playerid,BizzInfo[i][bEntrancex], BizzInfo[i][bEntrancey], BizzInfo[i][bEntrancez]) || PlayerToPoint(3, playerid,BizzInfo[i][bExitx], BizzInfo[i][bExity], BizzInfo[i][bExitz]))
{
if(PlayerInfo[playerid][pPbiskey] == i)
{
if(BizzInfo[i][bLock] == 1)
{
BizzInfo[i][bLock] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(BizzInfo[i][bLock] == 0)
{
BizzInfo[i][bLock] = 1;
GameTextForPlayer(playerid, "~w~Bussiness ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (PlayerToPoint(3, playerid,SBizzInfo[i][sbEntrancex], SBizzInfo[i][sbEntrancey], SBizzInfo[i][sbEntrancez]))
{
if(PlayerInfo[playerid][pPbiskey] == i+100)
{
if(SBizzInfo[i][sbLock] == 1)
{
SBizzInfo[i][sbLock] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(SBizzInfo[i][sbLock] == 0)
{
SBizzInfo[i][sbLock] = 1;
GameTextForPlayer(playerid, "~w~Bussiness ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]) || PlayerToPoint(3, playerid,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
{
if(PlayerInfo[playerid][pPhousekey] == i)
{
if(HouseInfo[i][hLock] == 1)
{
HouseInfo[i][hLock] = 0;
GameTextForPlayer(playerid, "~w~Door ~g~Unlocked", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(HouseInfo[i][hLock] == 0)
{
HouseInfo[i][hLock] = 1;
GameTextForPlayer(playerid, "~w~Door ~r~Locked", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
GameTextForPlayer(playerid, "~r~You Dont Have A Key", 5000, 6);
return 1;
}
}
}
new carid;
if (gTeam[playerid] == 2)
{
if(copcar[playerid] != 255)
{
carid = copcar[playerid];
if(GetPlayerVehicleID(playerid) == carid)
{
switch (copcarl[playerid])
{
case 0:
{
LockCar(carid);
copcarl[playerid] = 1;
SendClientMessage(playerid, COLOR_RED, "Cop Car Locked");
return 1;
}
case 1:
{
UnLockCar(carid);
copcarl[playerid] = 0;
SendClientMessage(playerid, COLOR_RED, "Cop Car Unlocked");
return 1;
}
}
}
}
}
if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
{
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][pCKey] == 0 && HireCar[playerid] == 299)
{
SendClientMessage(playerid, COLOR_GRAD2, "You dont have a Vehicle.");
return 1;
}
carid = PlayerInfo[playerid][pCKey];
if(HireCar[playerid] != 299 && !SwitchKey[playerid])
{
carid = HireCar[playerid];
}
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, " You dont have a Vehicle");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Hire Vehicle ~r~Locked", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
LockCar(carid);
}
else if (PlayerInfo[playerid][pCKey] == carid)
{
if (CInfo[carid-1][cLock] == 0)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have this upgrade installed");
return 1;
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Locked", 4000, 3);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 1;
LockCar(carid);
return 1;
}
}
case 1:
{
if(HireCar[playerid] == 299 && PlayerInfo[playerid][pPhousekey] == 255 && PlayerInfo[playerid][pCKey] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have a Vehicle");
return 1;
}
if(HireCar[playerid] == carid && !SwitchKey[playerid])
{
GameTextForPlayer(playerid, "~w~Hire Vehicle ~g~Unlocked", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
UnLockCar(carid);
}
if (PlayerInfo[playerid][pCKey] == carid)
{
if (CInfo[carid-1][cLock] == 0)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't have this upgrade installed");
return 1;
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~g~Unlocked", 4000, 3);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[carid] = 0;
UnLockCar(carid);
return 1;
}
}
default:
{
SendClientMessage(playerid, COLOR_GRAD2, " Error");
}
}
if(carid == 256 && PlayerInfo[playerid][pCKey] == 0)
{
SendClientMessage(playerid, COLOR_GRAD2, " You dont have a Vehicle");
}
return 1;
}
Reply
#8

BUMP , help please !!
Reply
#9

BUMP ~~ Help !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)