[Help] Lock player into vehicle -
Kenka - 13.07.2011
Hello, i want to know how to lock player into vehicle when he types command.
i tried
Код:
TogglePlayerControllable
but player can still exit vehicle.
And i also need system that locks car from outside also, so nobody can drag player out of car.
Re: [Help] Lock player into vehicle -
Shadoww5 - 13.07.2011
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(VARIABLE[playerid] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "You can not leave the vehicle.");
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
}
return 1;
}
Re: [Help] Lock player into vehicle -
Kenka - 13.07.2011
I don't understand what is
pawn Код:
if(VARIABLE[playerid] == 1)
but my system is like this
when player types command like /hotwire he has case 1: to start engine and case 2: to start alarm and lock player into vehicle for 10 seconds and then doors unlock and he can leave car.
Re: [Help] Lock player into vehicle -
Kenka - 13.07.2011
Still need help :/
(really sorry for bump but i need help )
Re: [Help] Lock player into vehicle -
lawonama - 13.07.2011
Write on the top of your script:
pawn Код:
new VARIABLE[MAX_PLAYERS];
when they write /hotwire add:
VARIABLE[playerid] = 1;
and then if(variable[playerid] ==1)
then his code
and if they sucsess hotwire then VARIABLE[playerid] = 0;
Re: [Help] Lock player into vehicle -
Kush - 13.07.2011
Change the 'VARIABLE' with your set variable. Whether it's stored in an enum or what-ever, simply replace it.
Example, in your enum you have lets say 'pLocked', it would then be:
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(pLocked[playerid] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "You can not leave the vehicle.");
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
}
return 1;
}
Re: [Help] Lock player into vehicle -
crowb14 - 13.07.2011
can i use this plz like so if i just copy this code and paste it in pawn and complie and then put it in my server.cfg and it would work if i type /plocked (ID)
Код:
public OnPlayerExitVehicle(playerid, vehicleid){ if(pLocked[playerid] == 1) { SendClientMessage(playerid, 0xFF0000FF, "You can not leave the vehicle."); PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid)); } return 1;}
like this code exacly the same way just paste and play will it work ??
Re: [Help] Lock player into vehicle -
Toreno - 13.07.2011
No, it won't work unless you make a command which locks and unlocks and changes the variable, if you do that then it might work, but you even don't know what to do or how to do so that would be hard for you, I guess.
Re: [Help] Lock player into vehicle -
Kenka - 13.07.2011
i tried with and without return 1; --- This way it compiles but it won't do anything
pawn Код:
if(Lukus[playerid] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "Auto uksed on lukus.");
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
}
This way i get 17 errors..
pawn Код:
if(Lukus[playerid] == 1)
{
SendClientMessage(playerid, 0xFF0000FF, "Auto uksed on lukus.");
PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
}
return 1;
}
And this should set Lukus[playerid] = 1;
pawn Код:
case 9,10,11,12,13,14,15:
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Alarm kдivitus ja sa jдid autosse kinni!");
gEngine[playerid] = 0;
SetTimerEx("AutoAlarm", 10000, false, "i", playerid);
Lukus[playerid] = 1;
}
And this one should set Lukus[playerid] = 0;
pawn Код:
public AutoAlarm(playerid)
{
if(IsPlayerConnected(playerid))
{
Lukus[playerid] = 0;
SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Alarm jдi vait ja uksed avanesid imekombel!");
}
}
Re: [Help] Lock player into vehicle -
boelie - 13.07.2011
i have another option;
i tried it once under OnPlayerKeyStateChange
if a player has a variable ..such as being a prisoner and he presses the key to enter/exit vehicle
it sends you a message that you cant exit the vehicle.
It worked but im not sure if its needed to put the player back in the vehicle if he tries to get out.
Its worth a try i guess..have fun