[Raven's Roleplay HELP] /lock doesn't work! [NOT SOLVED]
#1

Hi,

When I do "/lock" it locks 1 car, then I when "/lock" my second car, my first car unlocks?

--

Here's code:

Quote:

//----------------------------------[LOCK]-----------------------------------------------
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] == 9999)
{
SendClientMessage(playerid, COLOR_GRAD2, "** You dont have a Vehicle.");
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] == 9999)
{
if(HireCar[playerid] == 299)
{
SendClientMessage(playerid, COLOR_GRAD2, "** You dont have a Vehicle.");
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] == 9999)
{
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][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~House Vehicle ~r~Locked", 5000, 6);
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] == 9999)
{
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][pPhousekey] == carid-1)
{
GameTextForPlayer(playerid, "~w~House Vehicle ~g~Unlocked", 5000, 6);
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)
{
SendClientMessage(playerid, COLOR_GRAD2, "** You dont have a Vehicle !");
}
}
return 1;
}


if(strcmp(cmd, "/open", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]) || IsPlayerInRangeOfPoint(playerid, 3,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;
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i)
{
if(BizzInfo[i][bLocked] == 1)
{
BizzInfo[i][bLocked] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(BizzInfo[i][bLocked] == 0)
{
BizzInfo[i][bLocked] = 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 (IsPlayerInRangeOfPoint(playerid, 3,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
{
if(PlayerInfo[playerid][pPbiskey] == i+100)
{
if(SBizzInfo[i][sbLocked] == 1)
{
SBizzInfo[i][sbLocked] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(SBizzInfo[i][sbLocked] == 0)
{
SBizzInfo[i][sbLocked] = 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;
}
}
}
}

new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /open",d,m,y,h,mi,s,sendername);
CommandLog(string);
return 1;
}

if(strcmp(cmd, "/aopen", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]) || IsPlayerInRangeOfPoint(playerid, 3,HouseInfo[i][hExitx], HouseInfo[i][hExity], HouseInfo[i][hExitz]))
{
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;
}
}
}
for(new i = 0; i < sizeof(BizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]) || IsPlayerInRangeOfPoint(playerid, 3,BizzInfo[i][bExitX], BizzInfo[i][bExitY], BizzInfo[i][bExitZ]))
{
if(BizzInfo[i][bLocked] == 1)
{
BizzInfo[i][bLocked] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(BizzInfo[i][bLocked] == 0)
{
BizzInfo[i][bLocked] = 1;
GameTextForPlayer(playerid, "~w~Bussiness ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
}
for(new i = 0; i < sizeof(SBizzInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 3,SBizzInfo[i][sbEntranceX], SBizzInfo[i][sbEntranceY], SBizzInfo[i][sbEntranceZ]))
{
if(SBizzInfo[i][sbLocked] == 1)
{
SBizzInfo[i][sbLocked] = 0;
GameTextForPlayer(playerid, "~w~Bussiness ~g~Open", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
if(SBizzInfo[i][sbLocked] == 0)
{
SBizzInfo[i][sbLocked] = 1;
GameTextForPlayer(playerid, "~w~Bussiness ~r~Closed", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
return 1;
}
}
}
}
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /aopen",d,m,y,h,mi,s,sendername);
AdminLog(string);
return 1;
}
//----------------------------------[LOCK]-----------------------------------------------

Reply
#2

This command seems to be for a house system which uses a vehicle owning system too.

If you want a basic "/lock" command which just locks the vehicle you're in, so only you can get in it, this is not the right command for that.
Reply
#3

Quote:
Originally Posted by Hawky133
Посмотреть сообщение
This command seems to be for a house system which uses a vehicle owning system too.

If you want a basic "/lock" command which just locks the vehicle you're in, so only you can get in it, this is not the right command for that.
Would I be best off adding in a filter-script for that?
Reply
#4

You'll need to replace the lock command, or make another command and name it something different (e.g. /vlock and to unlock /vunlock).

If you search the Script Files and Includes section for "vehicle lock", you may find someone else has already made a system for you to download.

Otherwise, you'll need to make a lock system yourself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)