26.12.2012, 03:31
pawn Код:
CMD:vlock(playerid)
{
new engine, lights, alarm, doors, bonnet, boot, objective, string[96], vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
for(new v; v < MAX_PLAYER_VEHICLES; v++) {
if(IsPlayerInRangeOfPoint(playerid, 5.0, playerVehicles[playerid][v][cPos][0], playerVehicles[playerid][v][cPos][1], playerVehicles[playerid][v][cPos][2]) || GetPlayerState(playerid) == PLAYER_STATE_DRIVER && playerVehicles[playerid][v][cID] != INVALID_PLAYER_VEHICLE_ID) {
if(doors == 0) {
format(string, sizeof(string), "* %s has locked their vehicle.", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, alarm, 1, bonnet, boot, objective);
SetVehicleParamsForPlayer(vehicleid, playerid, 1, 1);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have locked your vehicle! (/clock to unlock it)"); break;
}
else if(doors == 1) {
format(string, sizeof(string), "* %s has unlocked their vehicle.", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
SetVehicleParamsForPlayer(vehicleid, playerid, 1, 0);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have unlocked your vehicle! (/clock to lock it)"); break;
}
else SendClientMessage(playerid, COLOR_GREY, "You are not near your vehicle!"); break;
}
}
return 1;
}