[AJUDA] Sistema de UP
#1

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;
}
Reply
#2

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 '-'
Reply
#3

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.
Reply
#4

Testa denovo o dei edit nele.
Reply
#5

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
Reply
#6

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!
Reply
#7

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'
Reply
#8

[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:
Reply
#9

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;
   }
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)