CMD:lock(playerid, params[])
{
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;
}
CMD:lock(playerid, params[])
{
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.");
new Float: x, Float: y, Float: z; // define the X, Y, Z
GetVehiclePos(id, x, y, z); // Get the Vehicle Position of the car
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) // If player near in the vehicle
{
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;
}
Stop reaching for more post counts, just reply once you got something useful to say, I have never seen anyone over here that obey all of the rules and never seen them getting punished for it or w/e.
|
Oh and to the people responding to this topic, remember that giving someone the code doesn't help them learn anything.
|
Ha. Ha. Ha. Ha. You think I need more posts? I have the second highest post count and the "competition" is 2,000 posts away from me. I could care less about my post count, so just don't even go there- you know it's a cheap shot.
If you're too ignorant to read and abide by the forum rules, then you shouldn't even be on this forum. Oh and to the people responding to this topic, remember that giving someone the code doesn't help them learn anything. |