[Ajuda] Sistema de experiкncia
#5

PHP код:
#include <a_samp>
#define MAX_LEVEL (4)
new ply_Level[MAX_PLAYERS];
new 
ply_Experience[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
SetPlayerLevel(playerid1);
    
SetPlayerExperience(playerid0);
    return 
1;
}
GetPlayerLevel(playerid)
    return 
ply_Level[playerid];
GetPlayerExperience(playerid)
    return 
ply_Experience[playerid];
SetPlayerLevel(playeridlevel)
{
    if (
level MAX_LEVEL)
        return 
1;
    return 
ply_Level[playerid] = level;
}
GivePlayerLevel(playeridlevel)
{
    if (
level MAX_LEVEL)
        return 
1;
    return 
ply_Level[playerid] += level;
}
SetPlayerExperience(playeridexperience)
{
    if (
experience GetLevelExperience(GetPlayerLevel(playerid)))
        return 
1;
    return 
ply_Experience[playerid] = experience;
}
GivePlayerExperience(playeridexperience)
{
    if (
experience GetLevelExperience(GetPlayerLevel(playerid)))
        return 
1;
    return 
ply_Experience[playerid] += experience;
}
GetLevelExperience(level)
{
    switch (
level)
    {
        case 
1: return 4;
        case 
2: return 15;
        case 
3: return 30;
        case 
4: return 50;
    }
    return 
0// Invalid level
}
public 
OnPlayerUpdate(playerid// Nгo use aqui, й apenas um exemplo!!
{
    
GivePlayerExperience(playerid1);
    if (
GetPlayerExperience(playerid) >= GetLevelExperience(GetPlayerLevel(playerid)))
    {
        
GivePlayerLevel(playerid1);
        
SetPlayerExperience(playerid0);
    }
    
printf("playerid %d - Level %d (%d/%d)"playeridGetPlayerLevel(playerid), GetPlayerExperience(playerid), GetLevelExperience(GetPlayerLevel(playerid)));
    return 
1;

Pode haver erros, eu fiz аs pressas e nгo testei.
Reply


Messages In This Thread
Sistema de experiкncia - by SORRISO22 - 27.04.2018, 16:21
Re: Sistema de experiкncia - by [BOPE]Seu._.Madruga - 28.04.2018, 02:57
Re: Sistema de experiкncia - by SORRISO22 - 28.04.2018, 15:22
Re: Sistema de experiкncia - by TIAGOO - 28.04.2018, 16:04
Re: Sistema de experiкncia - by 1sbedx - 28.04.2018, 16:41
Re: Sistema de experiкncia - by FerrariL - 28.04.2018, 16:51
Re: Sistema de experiкncia - by 1sbedx - 28.04.2018, 16:55
Re: Sistema de experiкncia - by FerrariL - 28.04.2018, 17:00
Re: Sistema de experiкncia - by 1sbedx - 28.04.2018, 17:16
Re: Sistema de experiкncia - by Eiss - 28.04.2018, 18:18

Forum Jump:


Users browsing this thread: 1 Guest(s)