SA-MP Forums Archive
[AJUDA] Sistema de UP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Sistema de UP (/showthread.php?tid=311250)



[AJUDA] Sistema de UP - Allanrokeiro - 15.01.2012

Seguinte, andei reparando nesse Sistema de Level UP, com o relуgio UP.. Quando um Player recebe um Experiкncia, o outro nгo recebe experiкncia, nгo aparece nada na tela do outro player, e se o outro player recebe experiкncia, o outro nгo recebe, e por ae vai, e tambйm o player que nгo recebeu a EXP nгo recebe e mensagem "| UP | Vocк ganhou...". Se alguйm puder ajudar D:

pawn Код:
public RelogioUP(i)
    {
        new string[256];
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(i, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(segUP == 0 && minUP == 0)
        {
            dini_IntSet(file, "EXP", dini_Int(file, "EXP")+1);
            format(string, sizeof(string), "| UP | Vocк ganhou +1 experiкncia! [%d / 5]",dini_Int(file, "EXP"));
            PlayerPlaySound(i, 1057, 0, 0, 0);
            GameTextForPlayer(i, "~w~UP!", 3000, 6);
            SendClientMessage(i, 0x75EA00AA, string);
            }
                if(dini_Int(file, "EXP") >=5){
                dini_IntSet(file, "Level", dini_Int(file, "Level")+1);
                format(string, sizeof(string), "| UP | Vocк juntou 5 experiкncias e ganhou +1 level! [ %d ] ",dini_Int(file, "Level"));
                SendClientMessage(i, 0x75EA00AA, string);
                dini_IntSet(file, "EXP",0);
                //dini_IntSet(file, "rouboubanco", 0);
                dini_IntSet(file, "CriouBarreira", 0);
                jasequestro[i] = 0;
                jacomeupizza[i] = 0;
                Up(i);
                }
                    if(segUP==-1){
                    if(minUP == 0)
                    minUP = 10;
                    segUP=59;
                    minUP--;
                    }
            if(segUP <= 9){ format(string,60,"     ~r~+ UP: ~w~%d:0%d",minUP,segUP);
            } else {
            format(string,60,"     ~r~+ UP: ~w~%d:%d",minUP,segUP);
            }
        TextDrawSetString(UPRelogio,string);
        segUP --;
    return 1;
}



Re: [AJUDA] Sistema de UP - Gui_Mendes - 15.01.2012

pawn Код:
public RelogioUP(playerid)
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new string[256];
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(i, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(segUP == 0 && minUP == 0)
        {
            dini_IntSet(file, "EXP", dini_Int(file, "EXP")+1);
            format(string, sizeof(string), "| UP | Vocк ganhou +1 experiкncia! [%d / 5]",dini_Int(file, "EXP"));
            PlayerPlaySound(i, 1057, 0, 0, 0);
            GameTextForPlayer(i, "~w~UP!", 3000, 6);
            SendClientMessage(i, 0x75EA00AA, string);
            }
                if(dini_Int(file, "EXP") >=5){
                dini_IntSet(file, "Level", dini_Int(file, "Level")+1);
                format(string, sizeof(string), "| UP | Vocк juntou 5 experiкncias e ganhou +1 level! [ %d ] ",dini_Int(file, "Level"));
                SendClientMessage(i, 0x75EA00AA, string);
                dini_IntSet(file, "EXP",0);
                //dini_IntSet(file, "rouboubanco", 0);
                dini_IntSet(file, "CriouBarreira", 0);
                jasequestro[i] = 0;
                jacomeupizza[i] = 0;
                Up(i);
                }
                    if(segUP==-1){
                    if(minUP == 0)
                    minUP = 10;
                    segUP=59;
                    minUP--;
                    }
            if(segUP <= 9){ format(string,60,"     ~r~+ UP: ~w~%d:0%d",minUP,segUP);
            } else {
            format(string,60,"     ~r~+ UP: ~w~%d:%d",minUP,segUP);
            }
        TextDrawSetString(UPRelogio,string);
        segUP --;
    }
   return 1;
   }
Edit : tenta denovo ae '-'


Re: [AJUDA] Sistema de UP - Allanrokeiro - 15.01.2012

What?

pawn Код:
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18547) : error 025: function heading differs from prototype
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18588) : warning 209: function "RelogioUP" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: [AJUDA] Sistema de UP - Gui_Mendes - 15.01.2012

Testa denovo o dei edit nele.


Re: [AJUDA] Sistema de UP - Allanrokeiro - 15.01.2012

O relуgio UP fica todo bugado, mudando de Minutos por exemplo, Estб 8:00, depois do nada vai para 0:01, depois pra 4:00. lol


Re: [AJUDA] Sistema de UP - Sergiinhonike - 15.01.2012

Allan, vai ai algumas dicas:
Tenta criar um tempo de up para cada player usando ex: Segundo[MAX_PLAYERS], Minuto[MAX_PLAYERS]...
Deixa o codigo de salvar no aquivo somente em algum tipo de stock "Salvardados(playerid)" ou outra.
Arrumar mais o seu codigo para nгo dar ideia pro lag ou ate mesmo pesar o seu script entende.

Estou sem tempo pra fazer o codigo completo mas tenho aqui no HD um tipo de LevelUp feito por mim mas nгo testei nem compilei entгo pode ser que tenha bugs. Espero que isto sirva como base.
PHP код:
public GanharLevel(playerid)
{
    if (
PlayerInfo[playerid][LSegundo] < 60)
    {
        
PlayerInfo[playerid][LSegundo] ++;
        return 
1;
    }
    else if (
PlayerInfo[playerid][LSegundo] == 60)
    {
        
PlayerInfo[playerid][LSegundo] = 0;
        
PlayerInfo[playerid][LMinuto] ++;
        if (
PlayerInfo[playerid][LMinuto] == 60)
        {
            
PlayerInfo[playerid][LMinuto] = 0;
            
PlayerInfo[playerid][LHora] ++;
        }
        if (
PlayerInfo[playerid][LHora] == 2)
        {
            
PlayerInfo[playerid][Level] ++;
            
PlayerInfo[playerid][LHora] = 0;
            
SendClientMessage(playeridMSG_INFO"Vocк ganhou um level. Up, up.");
        }
    }
    return 
1;

Obs: Nгo sei se funciona, nгo testei e nem compilei mas vocк pode tentar!


Re: [AJUDA] Sistema de UP - dPlaYer_ - 15.01.2012

Nгo seria assim?
pawn Код:
public RelogioUP()
{
    new string[256], segUP = 0, minUP = 0; minUP--;
    if(segUP<1) {
        segUP=59; minUP--;
    }
    if(minUP<1) {
        minUP = 9;
    }
    if(segUP <= 9) {
        format(string,60,"~w~%d:0%d +Exp",minUP,segUP);
    }
    else {
        format(string,60,"~w~%d:%d +Exp",minUP,segUP);
    }
    TextDrawSetString(UPRelogio,string);
    return 1;
}
pawn Код:
public LevelUP()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            new string[256];
            new aname[MAX_PLAYER_NAME];
            GetPlayerName(i, aname, MAX_PLAYER_NAME);
            format(file, sizeof(file), P_CONTAS, aname);
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Exp
            if(dini_Int(file, "Tempo") >=7)
            {
                dini_IntSet(file, "EXP", dini_Int(file, "EXP")+1);
                format(string, sizeof(string), "| UP | Vocк ganhou +1 experiкncia! [%d / 5]",dini_Int(file, "EXP"));
                PlayerPlaySound(i, 1057, 0, 0, 0);
                SendClientMessage(i, 0x75EA00AA, string);
                dini_IntSet(file, "Tempo",0);
            }
            if(dini_Int(file, "EXP") >=5)
            {
                dini_IntSet(file, "Level", dini_Int(file, "Level")+1);
                format(string, sizeof(string), "| UP | Vocк juntou 5 experiкncias e ganhou +1 level! [ %d ] ",dini_Int(file, "Level"));
                SendClientMessage(i, 0x75EA00AA, string);
                PlayerPlaySound(i, 1057, 0, 0, 0);
                dini_IntSet(file, "EXP",0);
                //dini_IntSet(file, "rouboubanco", 0);
                dini_IntSet(file, "CriouBarreira", 0);
                jasequestro[i] = 0;
                jacomeupizza[i] = 0;
            }
        }
    }
    return 1;
}
?
Ja que vc ja subistuiu a 'level up'


Re: [AJUDA] Sistema de UP - Allanrokeiro - 16.01.2012

[LF]Player...

pawn Код:
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17976) : error 001: expected token: ";", but found "}"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17982) : error 010: invalid function or declaration
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17986) : error 010: invalid function or declaration
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17988) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17992) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17993) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17994) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17995) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17996) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17997) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17998) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(17999) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18000) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18001) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18002) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18003) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18004) : error 021: symbol already defined: "dini_IntSet"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18009) : error 054: unmatched closing brace ("}")
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18554) : warning 219: local variable "segUP" shadows a variable at a preceding level
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18554) : warning 219: local variable "minUP" shadows a variable at a preceding level
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18570) : warning 203: symbol is never used: "minUP"
G:\Documents and Settings\AllanR\Meus documentos\NVC\gamemodes\GM2.pwn(18570) : warning 203: symbol is never used: "segUP"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


18 Errors.
E realmente estб certo, quando o relуgio chega a '0:00' Ganha 1 experiкncia... Mas quando um player recebe o outro nгo recebe, nem se quer aparece a mensagem, ou seja, nгo faz nenhuma aзгo.

@Edit

Alguйm ? D:


Re: [AJUDA] Sistema de UP - dPlaYer_ - 17.01.2012

pawn Код:
public RelogioUP(i)
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new string[256];
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(i, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(segUP == 0 && minUP == 0)
        {
            dini_IntSet(file, "EXP", dini_Int(file, "EXP")+1);
            format(string, sizeof(string), "| UP | Vocк ganhou +1 experiкncia! [%d / 5]",dini_Int(file, "EXP"));
            PlayerPlaySound(i, 1057, 0, 0, 0);
            GameTextForPlayer(i, "~w~UP!", 3000, 6);
            SendClientMessage(i, 0x75EA00AA, string);
            }
                if(dini_Int(file, "EXP") >=5){
                dini_IntSet(file, "Level", dini_Int(file, "Level")+1);
                format(string, sizeof(string), "| UP | Vocк juntou 5 experiкncias e ganhou +1 level! [ %d ] ",dini_Int(file, "Level"));
                SendClientMessage(i, 0x75EA00AA, string);
                dini_IntSet(file, "EXP",0);
                //dini_IntSet(file, "rouboubanco", 0);
                dini_IntSet(file, "CriouBarreira", 0);
                jasequestro[i] = 0;
                jacomeupizza[i] = 0;
                Up(i);
                }
                    if(segUP==-1){
                    if(minUP == 0)
                    minUP = 10;
                    segUP=59;
                    minUP--;
                    }
            if(segUP <= 9){ format(string,60,"     ~r~+ UP: ~w~%d:0%d",minUP,segUP);
            } else {
            format(string,60,"     ~r~+ UP: ~w~%d:%d",minUP,segUP);
            }
        TextDrawSetString(UPRelogio,string);
        segUP --;
    }
   return 1;
   }



Re: [AJUDA] Sistema de UP - Allanrokeiro - 18.01.2012

Quote:
Originally Posted by [LF]PlaYer
Посмотреть сообщение
pawn Код:
public RelogioUP(i)
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new string[256];
        new aname[MAX_PLAYER_NAME];
        GetPlayerName(i, aname, MAX_PLAYER_NAME);
        format(file, sizeof(file), P_CONTAS, aname);
        if(segUP == 0 && minUP == 0)
        {
            dini_IntSet(file, "EXP", dini_Int(file, "EXP")+1);
            format(string, sizeof(string), "| UP | Vocк ganhou +1 experiкncia! [%d / 5]",dini_Int(file, "EXP"));
            PlayerPlaySound(i, 1057, 0, 0, 0);
            GameTextForPlayer(i, "~w~UP!", 3000, 6);
            SendClientMessage(i, 0x75EA00AA, string);
            }
                if(dini_Int(file, "EXP") >=5){
                dini_IntSet(file, "Level", dini_Int(file, "Level")+1);
                format(string, sizeof(string), "| UP | Vocк juntou 5 experiкncias e ganhou +1 level! [ %d ] ",dini_Int(file, "Level"));
                SendClientMessage(i, 0x75EA00AA, string);
                dini_IntSet(file, "EXP",0);
                //dini_IntSet(file, "rouboubanco", 0);
                dini_IntSet(file, "CriouBarreira", 0);
                jasequestro[i] = 0;
                jacomeupizza[i] = 0;
                Up(i);
                }
                    if(segUP==-1){
                    if(minUP == 0)
                    minUP = 10;
                    segUP=59;
                    minUP--;
                    }
            if(segUP <= 9){ format(string,60,"     ~r~+ UP: ~w~%d:0%d",minUP,segUP);
            } else {
            format(string,60,"     ~r~+ UP: ~w~%d:%d",minUP,segUP);
            }
        TextDrawSetString(UPRelogio,string);
        segUP --;
    }
   return 1;
   }
Quando adiciona o "for(new i=0; i<MAX_PLAYERS; i++)" Fica todo bugado, indo do 9:00 para o 7:00 rбpidamente... sem mesmo passar segundos...