Initial commit for player keys
This commit is contained in:
47
Server/Events/Key.cs
Normal file
47
Server/Events/Key.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Key (Key.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Events
|
||||
{
|
||||
public class Key : Script
|
||||
{
|
||||
[RemoteEvent("keyPress:N")]
|
||||
public void KeyPressN(Client player)
|
||||
{
|
||||
if (NAPI.Player.IsPlayerInAnyVehicle(player))
|
||||
{
|
||||
bool engineStatus = NAPI.Vehicle.GetVehicleEngineStatus(player.Vehicle);
|
||||
if (engineStatus == false)
|
||||
{
|
||||
player.Vehicle.EngineStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Vehicle.EngineStatus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
[RemoteEvent("keyPress:X")]
|
||||
public void KeyPressX(Client player)
|
||||
{
|
||||
if (NAPI.Player.IsPlayerInAnyVehicle(player))
|
||||
{
|
||||
if (player.Seatbelt == false)
|
||||
{
|
||||
player.Seatbelt = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Seatbelt = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user