Ragemp-roleplay-skript/Levelsystem.cs
2019-04-16 13:59:07 +02:00

54 lines
No EOL
1.9 KiB
C#

using System;
using GrandTheftMultiplayer.Server;
using GrandTheftMultiplayer.Shared;
using GrandTheftMultiplayer.Server.API;
using GrandTheftMultiplayer.Shared.Math;
using GrandTheftMultiplayer.Server.Elements;
using System.Collections.Generic;
using GrandTheftMultiplayer.Server.Managers;
using GrandTheftMultiplayer.Server.Constant;
namespace Roleplay
{
class Levelsystem : Script
{
public static int getPlayerLevel(Client player){
return API.shared.getEntityData(player,"level");
}
public static int getPlayerLevelFortschritt(Client player){
return API.shared.getEntityData(player,"levelfortschritt");
}
public static void setPlayerLevel(Client player, int level){
API.shared.setEntityData(player,"level",level);
PlayerDatabase.setDatabaseData(player,"level",level);
return;
}
public static void setPlayerLevelFortschritt(Client player, int sascha){
API.shared.setEntityData(player,"levelfortschritt",sascha);
PlayerDatabase.setDatabaseData(player,"levelfortschritt",sascha);
return;
}
public static void addPlayerLevelFortschritt(Client player, int fortschrittpunkte, API api){
setPlayerLevelFortschritt(player,getPlayerLevelFortschritt(player) + fortschrittpunkte);
API.shared.sendNotificationToPlayer(player,"~g~+~y~" + fortschrittpunkte + " ~c~/~r~50 ~w~ Fortschrittspunkte");
if(getPlayerLevelFortschritt(player) >= 50){
setPlayerLevel(player,getPlayerLevel(player) + 1);
setPlayerLevelFortschritt(player,0);
ClientAPI.ShowColorShard(player,"Level UP!","Super du bist nun Level: " + getPlayerLevel(player) + "!",2,1,1000*4);
Environment.MONEY.Money.giveBarMoney(player,1000,api);
}
}
}
}