public static void FinishLogin(Client client) { int client_id = client.GetData("ID"); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); PlayerVehicles pVeh = PlayerHelper.GetpVehiclesStats(client); //Database.Update(playerInfo); playerInfo.Update(); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); EventTriggers.Update_Wanteds(client); NAPI.Player.SetPlayerName(client, playerInfo.vorname + "" + playerInfo.nachname); if (playerInfo.wantedlevel >= 1) { NAPI.Player.SetPlayerNametagColor(client, 249, 27, 27); } if (playerInfo.temp_location == null) { client.Position = playerInfo.GetLastPlayerLocation(); } else { client.Position = playerInfo.GetLastTempLocation(); client.SendChatMessage("~r~Du sitzt noch " + playerInfo.jailtime); client.Freeze(true); } if (playerInfo.cuff == 1) { client.SendChatMessage("~r~Du hast Offlineflucht begangen und sitzt nun 10 Minuten länger im Gefängnis!"); playerInfo.cuff = 0; playerInfo.Update(); } PlayerData.ResetClothes(client); PlayerVehicles.GetLastCarPosition(client); //client.SendNotification("~g~Erfolgreich eingeloggt!"); NAPI.ClientEvent.TriggerClientEvent(client, "LoginUnFreeze"); NAPI.ClientEvent.TriggerClientEvent(client, "CameraDestroy"); return; }
public static void FinishLogin(Client client) { int client_id = client.GetData("ID"); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client); PlayerVehicles pVeh = PlayerHelper.GetpVehiclesStats(client); //Database.Update(playerInfo); playerInfo.Update(); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); EventTriggers.Update_Wanteds(client); NAPI.Player.SetPlayerName(client, playerInfo.vorname + "" + playerInfo.nachname); if (playerInfo.wantedlevel >= 1) { NAPI.Player.SetPlayerNametagColor(client, 249, 27, 27); } if (playerInfo.cuff == 1) { client.SendNotification("~r~Suite à l'évasion tentée, vous recevez 5 minutes de prison supplémentaires."); playerInfo.jailtime += 300000; playerInfo.cuff = 0; playerInfo.jail = 1; playerInfo.Update(); } PlayerVehicles.GetLastCarPosition(client); //client.SendNotification("~g~Erfolgreich eingeloggt!"); NAPI.ClientEvent.TriggerClientEvent(client, "LoginUnFreeze"); NAPI.ClientEvent.TriggerClientEvent(client, "CameraDestroy"); PlayerData.Respawn(client); return; }
public void OnPlayerEinzahlung(Client client, int summe) { PlayerInfo pInfo = PlayerHelper.GetPlayerStats(client); if (pInfo.money < summe) { client.SendChatMessage("~r~Du hast nicht genung Bargeld!"); client.TriggerEvent("BankResult", 0); return; } else { pInfo.money -= summe; pInfo.bank += summe; client.SendChatMessage($"~w~Du hast ~g~${summe} ~w~auf dein Konto eingezahlt!"); client.SendChatMessage($"~w~Neuer Kontostand: ~g~${pInfo.bank}~w~ | Bargeld: ~g~${pInfo.money}"); client.TriggerEvent("BankResult", 1); Database.Upsert(pInfo); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); } }
public void OnPlayerEinzahlung(Client client, int summe) { PlayerInfo pInfo = PlayerHelper.GetPlayerStats(client); if (pInfo.money < summe) { client.SendChatMessage("~r~Vous n'avez pas assez d'argent!"); client.TriggerEvent("BankResult", 0); return; } else { pInfo.money -= summe; pInfo.bank += summe; client.SendChatMessage($"~w~Vous avez déposé ~g~${summe} ~w~sur votre compte"); client.SendChatMessage($"~w~Nouveau solde du compte ~g~${pInfo.bank}~w~ | trésorerie: ~g~${pInfo.money}"); client.TriggerEvent("BankResult", 1); Database.Upsert(pInfo); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); } }
public void OnPlayerUberweisungAttempt(Client client, string name, int summe) { if (!client.HasData("ID")) { return; } Client player = NAPI.Pools.GetAllPlayers().Find(x => x.Name == name); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo pInfo = PlayerHelper.GetPlayerStats(player); PlayerInfo otherInfo = Database.GetById <PlayerInfo>(pInfo._id); string spielername = pInfo.vorname + pInfo.nachname; /*if (name) * { * client.SendChatMessage("[~g~BANK~w~] Diese Person existiert nicht!"); * client.TriggerEvent("BankResult", 0); * return; * }*/ if (spielername == null) { client.SendChatMessage("[~g~BANK~w~] Diese Person existiert nicht!"); client.TriggerEvent("BankResult", 0); return; } if (summe <= 0) { client.SendChatMessage("[~g~BANK~w~] Dein Betrag ist zu klein!"); client.TriggerEvent("BankResult", 0); return; } else if (playerInfo.bank < summe) { client.SendChatMessage("[~g~BANK~w~] Dein Guthaben reicht nicht aus!"); client.TriggerEvent("BankResult", 0); return; } if (client.Name == player.Name) { client.SendChatMessage($"[~g~BANK~w~] Du kannst dir nicht selber Geld Überweisen!"); client.TriggerEvent("BankResult", 0); return; } else { client.SendChatMessage($"[~g~BANK~w~] Du hast {otherInfo.vorname}{otherInfo.nachname} ~g~{summe}$~w~ überwiesen!"); player.SendChatMessage($"[~g~BANK~w~] {playerInfo.vorname}{playerInfo.nachname} hat dir ~g~{summe}$~w~ überwiesen."); playerInfo.bank -= summe; otherInfo.bank += summe; Database.Update(playerInfo); EventTriggers.Update_Bank(client); Database.Update(otherInfo); EventTriggers.Update_Bank(player); } }
public void CMD_Revive(Client client, Client player) { PlayerInfo cInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo pInfo = PlayerHelper.GetPlayerStats(player); if (!FraktionSystem.HasRank(client, 2)) { client.SendNotification("~r~Vous n'appartenez pas à la SARU!"); return; } if (!client.HasData("onduty")) { client.SendNotification("~r~Vous n'êtes pas en service!"); return; } if (client.Position.DistanceTo2D(player.Position) <= 3) { if (!player.HasData("dead")) { client.SendNotification("Ce joueur n'est pas mort!"); return; } NAPI.Player.SpawnPlayer(player, pInfo.GetLastPlayerLocation()); player.SendNotification("Vous avez été réapparu!"); NAPI.ClientEvent.TriggerClientEvent(player, "DeathFalse"); player.ResetData("dead"); cInfo.money += 100; cInfo.Update(); client.SendNotification("[~r~SARU~w~]: Vous avez 100~g~$~w~."); if (pInfo.money > 100) { pInfo.money -= 100; pInfo.Update(); player.SendNotification("[~r~SARU~w~]: Vous avez payé 100~g~$~w~ pour le traitement.."); } else if (pInfo.bank > 100) { pInfo.bank -= 100; pInfo.Update(); player.SendNotification("[~r~SARU~w~]: Vous avez payé 100~g~$~w~ pour le traitement."); } else { client.SendNotification("[~y~EasterEgg~w~]: Tu es sacrément pauvre! Va travailler!"); } EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); EventTriggers.Update_Money(player); EventTriggers.Update_Bank(player); } else { client.SendNotification("Vous n'êtes pas près de cette personne!"); } }
public static void Respawn(Client client) { PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); if (playerClothes == null) { playerClothes = new PlayerClothes(); playerClothes._id = playerInfo._id; playerClothes.Upsert(); } client.SetClothes(1, playerClothes.clothes_1, 0); client.SetClothes(2, playerClothes.clothes_2, 0); client.SetClothes(3, playerClothes.clothes_3, 0); client.SetClothes(4, playerClothes.clothes_4, 0); client.SetClothes(5, playerClothes.clothes_5, 0); client.SetClothes(6, playerClothes.clothes_6, 0); client.SetClothes(7, playerClothes.clothes_7, 0); client.SetClothes(8, playerClothes.clothes_8, 0); client.SetClothes(9, playerClothes.clothes_9, 0); client.SetClothes(10, playerClothes.clothes_10, 0); client.SetClothes(11, playerClothes.clothes_11, 0); if (client.HasData("FrakVehicle")) { Vehicle previous_vehicle = client.GetData("FrakVehicle"); previous_vehicle.Delete(); client.ResetData("FrakVehicle"); client.SendNotification("Votre véhicule de faction a été supprimé!"); } if (client.HasData("onduty")) { client.ResetData("onduty"); client.SendNotification("Vous n'êtes plus en service!"); } if (client.HasData("fonduty")) { client.ResetData("fonduty"); client.SendNotification("Vous n'êtes plus en service!"); } if (playerInfo.jail == 1) { TimeSpan ts = TimeSpan.FromMilliseconds(playerInfo.jailtime); client.Position = playerInfo.GetLastTempLocation(); client.RemoveAllWeapons(); if (playerInfo.wantedlevel == 1) { playerInfo.jailtime += 60000; } else if (playerInfo.wantedlevel == 2) { playerInfo.jailtime += 120000; } else if (playerInfo.wantedlevel == 3) { playerInfo.jailtime += 180000; } else if (playerInfo.wantedlevel == 4) { playerInfo.jailtime += 240000; } else if (playerInfo.wantedlevel == 5) { playerInfo.jailtime += 300000; } else if (playerInfo.wantedlevel >= 6) { playerInfo.jailtime += 360000; } playerInfo.wantedlevel = 0; playerInfo.cuff = 0; playerInfo.Update(); NAPI.ClientEvent.TriggerClientEvent(client, "JailTrue"); client.SendNotification("[~b~LSPD~w~]: S'il vous plaît ne vous déconnectez pas ou vous serez assis à nouveau pendant si longtemps!"); client.SendNotification($"[~b~LSPD~w~]: Vous êtes assis pour ~r~{ts.Minutes}~w~ Minutes."); NAPI.Task.Run(() => { NAPI.ClientEvent.TriggerClientEvent(client, "JailFalse"); client.SendNotification("[~b~LSPD~w~]: Vous êtes libre maintenant!"); playerInfo.jail = 0; playerInfo.jailtime = 0; playerInfo.Update(); Respawn(client); }, delayTime: playerInfo.jailtime); } else { client.Position = playerInfo.GetLastPlayerLocation(); } EventTriggers.Update_Wanteds(client); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); client.SendNotification("~g~Vous etes réapparu!"); }
public static void Respawn(Client client) { PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); if (playerClothes == null) { playerClothes = new PlayerClothes(); playerClothes._id = playerInfo._id; playerClothes.Upsert(); } client.SetClothes(1, playerClothes.clothes_1, 0); client.SetClothes(2, playerClothes.clothes_2, 0); client.SetClothes(3, playerClothes.clothes_3, 0); client.SetClothes(4, playerClothes.clothes_4, 0); client.SetClothes(5, playerClothes.clothes_5, 0); client.SetClothes(6, playerClothes.clothes_6, 0); client.SetClothes(7, playerClothes.clothes_7, 0); client.SetClothes(8, playerClothes.clothes_8, 0); client.SetClothes(9, playerClothes.clothes_9, 0); client.SetClothes(10, playerClothes.clothes_10, 0); client.SetClothes(11, playerClothes.clothes_11, 0); if (client.HasData("FrakVehicle")) { Vehicle previous_vehicle = client.GetData("FrakVehicle"); previous_vehicle.Delete(); client.ResetData("FrakVehicle"); client.SendNotification("Dein Fraktionsfahrzeug wurde gelöscht!"); } if (client.HasData("onduty")) { client.ResetData("onduty"); client.SendNotification("Du bist nun nicht mehr im Dienst!"); } if (client.HasData("fonduty")) { client.ResetData("fonduty"); client.SendNotification("Du bist nun nicht mehr im Dienst!"); } if (playerInfo.jail == 1) { TimeSpan ts = TimeSpan.FromMilliseconds(playerInfo.jailtime); client.Position = playerInfo.GetLastTempLocation(); client.RemoveAllWeapons(); if (playerInfo.wantedlevel == 1) { playerInfo.jailtime += 60000; } else if (playerInfo.wantedlevel == 2) { playerInfo.jailtime += 120000; } else if (playerInfo.wantedlevel == 3) { playerInfo.jailtime += 180000; } else if (playerInfo.wantedlevel == 4) { playerInfo.jailtime += 240000; } else if (playerInfo.wantedlevel == 5) { playerInfo.jailtime += 300000; } else if (playerInfo.wantedlevel >= 6) { playerInfo.jailtime += 360000; } playerInfo.wantedlevel = 0; playerInfo.cuff = 0; playerInfo.Update(); NAPI.ClientEvent.TriggerClientEvent(client, "JailTrue"); client.SendNotification("[~b~LSPD~w~]: Bitte logge dich nicht aus sonst sitzt du wieder so lange!"); client.SendNotification($"[~b~LSPD~w~]: Du sitzt für ~r~{ts.Minutes}~w~ Minuten."); NAPI.Task.Run(() => { NAPI.ClientEvent.TriggerClientEvent(client, "JailFalse"); client.SendNotification("[~b~LSPD~w~]: Du bist nun frei!"); playerInfo.jail = 0; playerInfo.jailtime = 0; playerInfo.Update(); Respawn(client); }, delayTime: playerInfo.jailtime); } else { client.Position = playerInfo.GetLastPlayerLocation(); } EventTriggers.Update_Wanteds(client); EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); client.SendNotification("~g~Du wurdest respawnt!"); }
public void OnPlayerUberweisungAttempt(Client client, string name, int summe) { if (!client.HasData("ID")) { return; } Client player = NAPI.Pools.GetAllPlayers().Find(x => x.Name == name); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo pInfo = PlayerHelper.GetPlayerStats(player); PlayerInfo otherInfo = Database.GetById <PlayerInfo>(pInfo._id); string spielername = pInfo.vorname + pInfo.nachname; /*if (name) * { * client.SendChatMessage("[~g~BANK~w~] Diese Person existiert nicht!"); * client.TriggerEvent("BankResult", 0); * return; * }*/ if (spielername == null) { client.SendChatMessage("[~g~BANK~w~] Cette personne n'existe pas"); client.TriggerEvent("BankResult", 0); return; } if (summe <= 0) { client.SendChatMessage("[~g~BANK~w~] Votre montant est trop petit!"); client.TriggerEvent("BankResult", 0); return; } else if (playerInfo.bank < summe) { client.SendChatMessage("[~g~BANK~w~] Votre crédit ne suffit pas!"); client.TriggerEvent("BankResult", 0); return; } if (client.Name == player.Name) { client.SendChatMessage($"[~g~BANK~w~] Vous ne pouvez pas transférer de l'argent vous-même!"); client.TriggerEvent("BankResult", 0); return; } else { client.SendChatMessage($"[~g~BANK~w~] Tu as payé ~g~{summe}$~w~ à {otherInfo.vorname}{otherInfo.nachname} "); player.SendChatMessage($"[~g~BANK~w~] {playerInfo.vorname}{playerInfo.nachname} t'as payé ~g~{summe}$~w~ "); playerInfo.bank -= summe; otherInfo.bank += summe; Database.Update(playerInfo); EventTriggers.Update_Bank(client); Database.Update(otherInfo); EventTriggers.Update_Bank(player); } }
public void CMD_Revive(Client client, Client player) { PlayerInfo cInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo pInfo = PlayerHelper.GetPlayerStats(player); if (!FraktionSystem.HasRank(client, 2)) { client.SendNotification("~r~Du gehörst nicht zur SARU!"); return; } if (!client.HasData("onduty")) { client.SendNotification("~r~Du bist nicht im Dienst!"); return; } if (client.Position.DistanceTo2D(player.Position) <= 3) { if (!player.HasData("dead")) { client.SendNotification("Dieser Spieler ist nicht gestorben!"); return; } NAPI.Player.SpawnPlayer(player, pInfo.GetLastPlayerLocation()); player.SendNotification("Du wurdest respawnt!"); NAPI.ClientEvent.TriggerClientEvent(player, "DeathFalse"); player.ResetData("dead"); cInfo.money += 100; cInfo.Update(); client.SendNotification("[~r~SARU~w~]: Du hast 100~g~$~w~ erhalten."); if (pInfo.money > 100) { pInfo.money -= 100; pInfo.Update(); player.SendNotification("[~r~SARU~w~]: Du hast für die Behandlung 100~g~$~w~ bezahlt."); } else if (pInfo.bank > 100) { pInfo.bank -= 100; pInfo.Update(); player.SendNotification("[~r~SARU~w~]: Du hast für die Behandlung 100~g~$~w~ bezahlt."); } else { client.SendNotification("[~y~EasterEgg~w~]: Du bist verdammt arm! geh arbeiten!"); } EventTriggers.Update_Money(client); EventTriggers.Update_Bank(client); EventTriggers.Update_Money(player); EventTriggers.Update_Bank(player); } else { client.SendNotification("Du bist nicht in der Nähe dieser Person!"); } }