Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- #if defined DEBUG
- printf("[debug] OnPlayerKeyStateChange(%d, %d, %d)", playerid, newkeys, oldkeys);
- #endif
- if(IsKeyJustDown(KEY_SUBMISSION, newkeys, oldkeys))
- {
- if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
- { // For impounding cars.
- new
- playerTowTruck = GetPlayerVehicleID(playerid);
- if(!IsTrailerAttachedToVehicle(playerTowTruck))
- {
- new
- targetVehicle = GetClosestVehicle(playerid, playerTowTruck); // Exempt the player's own vehicle from the loop.
- if(!IsAPlane(targetVehicle) && IsPlayerInRangeOfVehicle(playerid, targetVehicle, 10.0))
- {
- AttachTrailerToVehicle(targetVehicle, playerTowTruck);
- }
- }
- else DetachTrailerFromVehicle(playerTowTruck);
- }
- if(IsPlayerInRangeOfPoint(playerid, 7.0, -26.3642,41.3313,1000.3384))
- {
- new Float:vehx, Float:vehy, Float:vehz;
- GetVehiclePos(lastcar, vehx, vehy, vehz);
- SetPlayerPos(playerid, vehx, vehy, vehz);
- }
- }
- if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys))
- {
- if(GetPlayerWeapon(playerid) == 17 && !IsPlayerInAnyVehicle(playerid) && playerVariables[playerid][pFreezeType] == 0)
- {
- foreach(Player, i)
- {
- if(playerid != i && !IsPlayerInAnyVehicle(i) && playerVariables[i][pFreezeType] == 0 && GetPlayerSkin(i) != 285)
- {
- if(IsPlayerAimingAtPlayer(playerid, i))
- {
- playerVariables[i][pFreezeType] = 5; // Using 5 on FreezeType makes more sense
- playerVariables[i][pFreezeTime] = 10;
- TogglePlayerControllable(i, false);
- SetPlayerDrunkLevel(i, 50000);
- ApplyAnimation(i, "FAT", "IDLE_TIRED", 4.1, 1, 1, 1, 1, 0, 1);
- }
- }
- }
- }
- }
- if(IsKeyJustDown(KEY_WALK, newkeys, oldkeys))
- {
- if(playerVariables[playerid][pSpectating] != INVALID_PLAYER_ID && playerVariables[playerid][pAdminLevel] >= 1)
- {
- playerVariables[playerid][pSpectating] = INVALID_PLAYER_ID;
- TogglePlayerSpectating(playerid, false);
- SetCameraBehindPlayer(playerid);
- SetPlayerPos(playerid, playerVariables[playerid][pPos][0], playerVariables[playerid][pPos][1], playerVariables[playerid][pPos][2]);
- SetPlayerInterior(playerid, playerVariables[playerid][pInterior]);
- SetPlayerVirtualWorld(playerid, playerVariables[playerid][pVirtualWorld]);
- TextDrawHideForPlayer(playerid, textdrawVariables[4]);
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment