Lock any car from the inside -
RALL0 - 21.07.2013
How can I lock any car from the inside or else from the outside IF they have the key.
pawn Код:
CMD:lock(playerid, params[])
{
if(PlayerInfo[playerid][pZombie] == 1) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You can't perform this action as a zombie.");
new vehicleid;
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(!vehicleid) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You aren't near your vehicle.");
new id = GetVehicleID(vehicleid);
if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You don't have the keys for that.");
if(GetPlayerVehicleAccess(playerid, id) < 2)
return SendClientMessage(playerid, COLOR_DARKRED, "[SERVER] {FFFFFF}You don't have the keys for that.");
if(doors == 1 || GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
doors = 0;
VehicleLock[id] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Unlocked.");
}
else
{
doors = 1;
VehicleLock[id] = 1;
SendClientMessage(playerid, COLOR_RED, "Locked.");
}
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SaveVehicle(id);
return 1;
}
Re: Lock any car from the inside -
PrinceKumar - 21.07.2013
pawn Код:
CMD:lock(playerid, params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new vehicleid = GetPlayerVehicleID(playerid);
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(doors == 1)
{
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,engine,lights,alarm,false,bonnet,boot,objective);
GameTextForPlayer(playerid,"Vehicle Unlocked!",2000,6);
return 1;
}
else
SetVehicleParamsEx(vehicleid,engine,lights,alarm,true,bonnet,boot,objective);
GameTextForPlayer(playerid,"Vehicle Locked!",2000,6);
}else return SendClientMessage(playerid,-1,"Error: You are not in a vehicle!");
return 1;
}
use this or make your cmd like that cause now i m going so i m not able to create it as your cmd. check if it works.
Edit : sorry it is wrong please don't use it
Re: Lock any car from the inside -
RALL0 - 21.07.2013
The player who actually owns the nearest vehicle and got the keys for it won't be able to unlock the vehicle with your code
Re: Lock any car from the inside -
RALL0 - 21.07.2013
Bump