sistema de level por exp
#1

ae galera to a 2 dias aprendendo pawn ^^, ja tive umas ideia , cria um sistema de level
olha so minha ideia alguem correge eu dps

no sistema de registro tem isso
enum pInfo
{
Deaths,
Kills,
ServerTime
}
posso coloca em baxo tipo experiencia?
ai

ai mais em baxo
public OnPlayerDisconnect(playerid, reason)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Contas/%s.ini",name);
if(fexist(file))
{
dini_IntSet(file,"Score", GetPlayerScore(playerid));
dini_IntSet(file,"Money", GetPlayerMoney(playerid));
dini_IntSet(file,"Deaths", PlayerInfo[playerid][Deaths]);
dini_IntSet(file,"Kills", PlayerInfo[playerid][Kills]);
dini_IntSet(file,"ServerTime", PlayerInfo[playerid][ServerTime]);
dini_IntSet(file,"experiencia", PlayerInfo[playerid][kills]);
}

IsLogged[playerid] = 0;
KillTimer(TimeTimer);
return 1;
}

public OnPlayerDeath(playerid, killerid)
{
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[killerid][Kills] ++;
return 1;
}
como eu colocaria pra tipo ele mata 1 pessoa e ganha 3exp
ai precisa de 3 exp pra level 2, 6 exp pra level 3, 4 exp pra level 9 ...
alguem pode ajuda
a ideia e um codigo ke deve da uns 300 erros eu tenho so falta organiza
Reply
#2

mals ae vo te ke faze double post

ningueim ajuda ai nao?
Reply
#3

Pode, e tem que colocar de volta as variбveis quando o jogador voltar.
Reply
#4

@Pedro
Fiz um Tutorial disso,procura em meus Tutoriais ¬¬
Reply
#5

drakins dei uma baseada(fumei um zim) nos teus tutos
e ficaria mais ou menos assim ?
Код:
#include <a_samp>
#include <Dini>
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw0[MAX_PLAYERS];
new Level[MAX_PLAYERS];
new Exp[MAX_PLAYERS];
#define COR_AQUI 0xFF00EBFF
public OnPlayerSpawn(playerid)
{
SetTimerEx("Timer",1000*60,true,"i",playerid);
SetTimer("ActualizarTextDraws",true,1000*60);
///////////////////////// Level ////////////////////////////////////////////////
Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Level: 0");
TextDrawBackgroundColor(Textdraw0[playerid], 255);
TextDrawFont(Textdraw0[playerid], 3);
TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw0[playerid], 65535);
TextDrawSetOutline(Textdraw0[playerid], 0);
TextDrawSetProportional(Textdraw0[playerid], 1);
TextDrawSetShadow(Textdraw0[playerid], 1);
//////////////////////////Exp//////////////////////////////////////////////
Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "Exp: 0/5");
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
TextDrawColor(Textdraw1[playerid], -16776961);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 1);
TextDrawSetShadow(Textdraw1[playerid], 1);
return 1;
}
forward ActualizarTextDraws();
public ActualizarTextDraws()
{
new String[100];

for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
{
if(IsPlayerConnected(playerid))
{
format(String, sizeof(String), "Level: %d", Level[playerid]);
TextDrawSetString(Textdraw0[playerid], String);
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
format(String, sizeof(String), "Exp: %d", Exp[playerid]);
TextDrawSetString(Textdraw1[playerid], String);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
}
}
}
public OnPlayerDeath(playerid, killerid)
{
Exp[killerid][Kills] ++;
if(Exp[playerid] == 5)
{
Level[playerid]++;
Exp[playerid] = 0;
}
return 1;
}

public OnPlayerConnect(playerid)
{
if(dini_Isset("levels.dkn",PlayerName(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",PlayerName(playerid)));
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
return 1;
}
public OnGameModeInit()
{
if(!fexist("levels.dkn")) dini_Create("levels.dkn");
return 1;
}
stock PlayerName(playerid)
{
new PlayerNameLevel[MAX_PLAYERS];
GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
return PlayerNameLevel;
}
so trokei public Timer(playerid) por public OnPlayerDeath(playerid, killerid)
c eu dexo na playerdeath Exp[playerid]++; nao da erro mais c eu dexo Exp[killerid][Kills]++; da esse aki \/
Код:
C:\Documents and Settings\pedro\Meus documentos\[FS] Level's DKN.pwn(53) : warning 215: expression has no effect
C:\Documents and Settings\pedro\Meus documentos\[FS] Level's DKN.pwn(53) : error 001: expected token: ";", but found "["
C:\Documents and Settings\pedro\Meus documentos\[FS] Level's DKN.pwn(53) : error 029: invalid expression, assumed zero
C:\Documents and Settings\pedro\Meus documentos\[FS] Level's DKN.pwn(53) : error 017: undefined symbol "Kills"
C:\Documents and Settings\pedro\Meus documentos\[FS] Level's DKN.pwn(53) : fatal error 107: too many error messages on one line
qual eu dexo ai manin?
Reply
#6

ninguem pode ajuda nao?
aki em ksa a net nao ta pegando host
e pra testa eu ia te ke mata alguem
e nao tem como mata alguem sendo ke so tme eu no sv
Reply
#7

pawn Код:
#include <a_samp>
#include <Dini>
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw0[MAX_PLAYERS];
new Level[MAX_PLAYERS];
new Exp[MAX_PLAYERS];
#define COR_AQUI 0xFF00EBFF

public OnPlayerSpawn(playerid)
{
    SetTimerEx("Timer",1000*60,true,"i",playerid);
    SetTimer("ActualizarTextDraws",true,1000*60);
    ///////////////////////// Level ////////////////////////////////////////////////
    Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Level: 0");
    TextDrawBackgroundColor(Textdraw0[playerid], 255);
    TextDrawFont(Textdraw0[playerid], 3);
    TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
    TextDrawColor(Textdraw0[playerid], 65535);
    TextDrawSetOutline(Textdraw0[playerid], 0);
    TextDrawSetProportional(Textdraw0[playerid], 1);
    TextDrawSetShadow(Textdraw0[playerid], 1);
    //////////////////////////Exp//////////////////////////////////////////////
    Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "Exp: 0/5");
    TextDrawBackgroundColor(Textdraw1[playerid], 255);
    TextDrawFont(Textdraw1[playerid], 1);
    TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
    TextDrawColor(Textdraw1[playerid], -16776961);
    TextDrawSetOutline(Textdraw1[playerid], 0);
    TextDrawSetProportional(Textdraw1[playerid], 1);
    TextDrawSetShadow(Textdraw1[playerid], 1);
    return 1;
}
forward ActualizarTextDraws();
public ActualizarTextDraws()
{
    new String[100];
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            format(String, sizeof(String), "Level: %d", Level[playerid]);
            TextDrawSetString(Textdraw0[playerid], String);
            TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
            format(String, sizeof(String), "Exp: %d", Exp[playerid]);
            TextDrawSetString(Textdraw1[playerid], String);
            TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
        }
    }
}
public OnPlayerDeath(playerid, killerid)
{
    Exp[killerid]++;
    if(Exp[playerid] == 5)
    {
        Level[playerid]++;
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(dini_Isset("levels.dkn",PlayerName(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",PlayerName(playerid)));
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
    return 1;
}
public OnGameModeInit()
{
    if(!fexist("levels.dkn")) dini_Create("levels.dkn");
    return 1;
}
stock PlayerName(playerid)
{
    new PlayerNameLevel[MAX_PLAYERS];
    GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
    return PlayerNameLevel;
}
Sem Double
Reply
#8

drakin vlw ae
so uma obs
primero post dia 4 e o 2 post dia 6
intao podia fazer double

vo testa o codigo aki
dps falo no ke deu
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)