13.12.2016, 14:11
pawn Код:
CMD:rollwindow(playerid, params[])
{
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You need to be driver to use this command.");
// or if you want passengers to be able to use the command, replace the above with the one below
// if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "You need to be in a vehicle to use this command.");
new window;
if (sscanf(params, "i", window))
{
SendClientMessage(playerid, -1, "Usage: /rollwindow <window>");
SendClientMessage(playerid, -1, "Windows: 1 - driver | 2 - passenger | 3 - back left | 4 - back right");
return 1;
}
if (!(1 <= window <= 4)) return SendClientMessage(playerid, -1, "The value of 'window' parameter should be between 1 and 4");
new window_state[4], vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsCarWindows(vehicleid, window_state[0], window_state[1], window_state[2], window_state[3]);
window_state[--window] = !window_state[window];
SetVehicleParamsCarWindows(vehicleid, window_state[0], window_state[1], window_state[2], window_state[3]);
return 1;
}