Problemas con mi sistema de orina.
#1

Bueno, hice un sistema de orina que metн dentro de mi gamemode, pero tengo un problema.. Se supone que yo quise hacer que al llegar a 100 de orina, uno orine automбticamente (se orine encima) y que al tener menos de 50 de orina, que no pueda orinar, pero mi problema es que al tener menos de 50, uno orina igual, y el progressbar que tendrнa que estar sobre el chaleco antibalas segъn mis coordenadas, no aparece..

pawn Код:
new Orinando[MAX_PLAYERS];
new Bar: barraorina[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
#define COLOR_PURPLE 0xC2A2DAAA
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <progressbar>
pawn Код:
new Orinando[MAX_PLAYERS];
new Bar: barraorina[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_GRAD2 0xBFC0C2FF
Obviamente, hay muchos mбs aparte de jOrina, pero puse sуlo jOrina y jSexo que son los que importan (jSexo 1 es masculino, jSexo 2 es femenino)..
pawn Код:
enum jInfo
{
        jSexo,
    jOrina
};
new JugadorInfo[MAX_PLAYERS][jInfo];
Йsta es la callback del payday, para que en cada payday vaya aumentando la orina..
pawn Код:
public PayDay()
{
    new string[128];
    new account;
    new interest,rent = 0, key;
    PayDayLeft = 60;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(JugadorInfo[i][jNivel] > 0)
            {
                new playername2[MAX_PLAYER_NAME];
                GetPlayerName(i, playername2, sizeof(playername2));
                account = JugadorInfo[i][jCuenta];
                if(key != 255)
                {
                    rent = HouseInfo[key][hRent];
                    if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
                    {
                        rent = 0;
                    }
                    else if(rent > GetPlayerMoney(i))
                    {
                        HouseInfo[key][hRooms] += 1;
                        JugadorInfo[i][pPhousekey] = 999;
                        SendClientMessage(i, COLOR_BLANCO, "Usted ha sido desalojado de su casa, debido a que no pagу el alquiler.");
                        JugadorInfo[i][pRent] = 0;
                        rent = 0;
                    }
                    HouseInfo[key][hRentabil] = HouseInfo[key][hRentabil]+rent;
                }
                    new tmpintrate;
                    Tax += TaxValue;//Should work for every player online
                    JugadorInfo[i][jCuenta] -= TaxValue;
                    new checks = 0;
                    account += checks;
                    interest = (JugadorInfo[i][jCuenta]/1000)*(tmpintrate);
                    JugadorInfo[i][jCuenta] = account+interest;
                    new ebill = 20;
                    if(JugadorInfo[i][pPhousekey] != 999 || JugadorInfo[i][pPbiskey] != 255)
                    {
                        JugadorInfo[i][jCuenta] -= ebill;
                    }
                    else
                    {
                        ebill = 0;
                    }
                    SendClientMessage(i, COLOR_ASKQ, "|___ Estado Bancario ___|");
                    format(string, sizeof(string), "  Pago: $%d   Impuestos: -$%d", checks, TaxValue);
                    SendClientMessage(i, COLOR_BLANCO, string);
                    if(JugadorInfo[i][pPhousekey] != 255 || JugadorInfo[i][pPbiskey] != 255)
                    {
                        format(string, sizeof(string), "  Boleta de Electricidad: -$%d", ebill);
                        SendClientMessage(i, COLOR_GRAD1, string);
                    }
                    if(JugadorInfo[i][pSeguro] != 0)
                    {
                        SendClientMessage(i, COLOR_GRAD2, "  Pago del Seguro: -$200");
                        Compra(i, 200)
                    }
                    format(string, sizeof(string), "  Interйs $%d", interest);
                    SendClientMessage(i, COLOR_GRAD2, string);
                    format(string, sizeof(string), "  Gastos totales: $%d", TaxValue + ebill);
                    SendClientMessage(i, COLOR_GRAD3, string);
                    format(string, sizeof(string), "  Beneficios totales: $%d", checks-ebill-TaxValue);
                    SendClientMessage(i, COLOR_GRAD3, string);
                    SendClientMessage(i, 0xB6B6B6FF, "|--------------------------------------|");
                    format(string, sizeof(string), "  Antiguo balance: %d$", JugadorInfo[i][jCuenta] - checks + ebill + TaxValue);
                    SendClientMessage(i, 0x00711DFF, string);
                    format(string, sizeof(string), "  Nuevo balance: %d$", JugadorInfo[i][jCuenta]);
                    SendClientMessage(i, 0x00CC00FF, string);
                    format(string, sizeof(string), "~h~~g~dia de paga");
                    GameTextForPlayer(i, string, 5000, 1);
                    cNicotina[i] = 0;   cEnergysil[i] = 0;  cSIDA[i] = 0;   cCancer[i] = 0;     cEpilepsia[i] = 0;
                    JugadorInfo[i][pRob] = 0;
                    JugadorInfo[i][pConnectTime] += 1;
                    JugadorInfo[i][pExp]++;
                    JugadorInfo[i][jOrina] += 16.666666666666666666666666666667;
                    if(JugadorInfo[i][pContract] > 0){JugadorInfo[i][pContract] --;}

                }
            }
        }
    SaveAccounts();
    return 1;
}
Йsto para que se actualice.
pawn Код:
forward OnPlayerUpdate(playerid);
public OnPlayerUpdate(playerid)
{
    if(JugadorInfo[playerid][jOrina] == 50)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 60)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 60%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 80)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 100)
    {
        new string[128];
        format(string, sizeof(string), "%s se orina involuntariamente, debido a que no aguantу.", PlayerName(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        JugadorInfo[playerid][jOrina] = 0;
                Orinando[playerid] = 1;
        SetPlayerSpecialAction(playerid,68);
        SendClientMessage(playerid, -1, "ЎOh! {FF0000}se ha orinado encima. {FFFFFF}Que desilusiуn, la prуxima vez evite йsto.");
        SendClientMessage(playerid, COLOR_GRAD2, "Utilice: /dorinar");
    }
    barraorina[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100);
    ShowProgressBarForPlayer(playerid, barraorina[playerid]);
    SetProgressBarValue(barraorina[playerid], JugadorInfo[playerid][jOrina]);
    UpdateProgressBar(barraorina[playerid], playerid);
    return 1;
}
Йstos son los comandos (/orinar para orinar, y /dorinar para dejar de orinar).
pawn Код:
zcmd(orinar, playerid, params[])
    {
        if(JugadorInfo[playerid][jOrina] > 50) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no tiene ganas de orinar.");
        if(Orinando[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Usted ya estб orinando.");
        if(JugadorInfo[playerid][jSexo] == 1)
        {
            new string[256];
            SetPlayerSpecialAction(playerid,68);
            JugadorInfo[playerid][jOrina] = 0;
            Orinando[playerid] = 1;
            format(string, sizeof(string), "%s se baja el cierre de su pantalуn y comienza a orinar.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
        }
        else if(JugadorInfo[playerid][jSexo] == 2)
        {
            new string[256];
            ApplyAnimation(playerid, "ped", "SEAT_down", 4.000000, 0, 0, 0, 1, 0);
            JugadorInfo[playerid][jOrina] = 0;
            Orinando[playerid] = 1;
            format(string, sizeof(string), "%s se baja el cierre de su pantalуn, se sienta y comienza a orinar.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
        }
        return 1;
    }
    zcmd(dorinar, playerid, params[])
    {
        if(Orinando[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no estб orinando.");
        if(JugadorInfo[playerid][jSexo] == 1)
        {
            new string[256];
            Orinando[playerid] = 0;
            ClearAnimations(playerid, 0);
            format(string, sizeof(string), "%s para de orinar y se sube el cierre de su pantalуn.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        if(JugadorInfo[playerid][jSexo] == 2)
        {
            new string[256];
            Orinando[playerid] = 0;
            ClearAnimations(playerid, 0);
            format(string, sizeof(string), "%s para de orinar, luego se sube el cierre del pantalуn y se levanta.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
Creo que no hace falta poner la funciуn de PlayerName y la de ProxDetector..

No sй porque pasa eso, el GM copila perfectamente, sin ningъn warning.

Por cierto, tengo otra duda.. їquй diferencia hay entre OnPlayerUpdate y OnPlayerUpdateTime? їpuedo tener ambas callback en mi GM?
Reply
#2

pawn Код:
if(JugadorInfo[playerid][jOrina] > 50) return SendClientMessage(playerid, COLOR_GRAD, "No tienes ganar de orinar.");
Reply
#3

їY la soluciуn a que no aparezca mi progressbar?
Reply
#4

pawn Код:
forward OnPlayerUpdate(playerid);
public OnPlayerUpdate(playerid)
{
    barraorina[playerid] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100);
    ShowProgressBarForPlayer(playerid, barraorina[playerid]);
    SetProgressBarValue(barraorina[playerid], JugadorInfo[playerid][jOrina]);
    UpdateProgressBar(barraorina[playerid], playerid);
    if(JugadorInfo[playerid][jOrina] == 50)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 60)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 60%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 80)
    {
        new string[128];
        format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
        SendClientMessage(playerid, -1, string);
    }
    if(JugadorInfo[playerid][jOrina] == 100)
    {
        new string[128];
        format(string, sizeof(string), "%s se orina involuntariamente, debido a que no aguantу.", PlayerName(playerid));
        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        JugadorInfo[playerid][jOrina] = 0;
                Orinando[playerid] = 1;
        SetPlayerSpecialAction(playerid,68);
        SendClientMessage(playerid, -1, "ЎOh! {FF0000}se ha orinado encima. {FFFFFF}Que desilusiуn, la prуxima vez evite йsto.");
        SendClientMessage(playerid, COLOR_GRAD2, "Utilice: /dorinar");
    }
    return 1;
}
EDIT: ke no aparezca o ke aparezca ?
Reply
#5

Sigue sin aparecer la progressbar, lo que quiero es que aparezca..

Y sospecho que el error estй en la callback de OnPlayerUpdate, ya que forcй el payday 4 veces, que se supone que me tendrнa que llegar un mensaje diciendo que tengo 50% y no lo hace, y por ende, no aparece el progressbar.
Reply
#6

yo te diria ke l o hagas de nuevo y trankilo.

1- estas poniendo todo en OnPlayerUpdate y creandolo con CreateProgressBar y ese cal actualiza muchas veces.
2- es mejor usar switch para lo ke estas haciendo , mas rapido.
3- yo te sugiero ke crees un public con un timer en vez de ponerlo en OnPlayerUpdate.
4- no es necesario colocar tantos new string.
5- new string[256]; no existe en el chat.

pawn Код:
#include <a_samp>
    #include <sscanf2>
    #include <zcmd>
    #include <progressbar>

    new Orinando[MAX_PLAYERS];
    new Bar:barraorina[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
    #define COLOR_PURPLE 0xC2A2DAAA
    #define COLOR_GRAD2 0xBFC0C2FF

    enum jInfo
    {
        jSexo,
        jOrina,
        jKillTimer
    };
    new JugadorInfo[MAX_PLAYERS][jInfo];

    //OnPlayerConnect
    JugadorInfo[playerid][jOrina] = CreateProgressBar(548.5, 36.0, _, _,, 0xDFD575FF, 100.0);
    JugadorInfo[playerid][jKillTimer] = SetTimerEx("actualizarorina", 1000, true, "i", playerid);

    //OnPlayerDisconnect
    DestroyProgressBar(JugadorInfo[playerid][jOrina]);
    KillTimer(JugadorInfo[playerid][jKillTimer]);

    forward actualizarorina(playerid);
    public actualizarorina(playerid)
    {
        new string[128];
        ShowProgressBarForPlayer(playerid, barraorina[playerid]);
        SetProgressBarValue(barraorina[playerid], JugadorInfo[playerid][jOrina]);
        UpdateProgressBar(barraorina[playerid], playerid);
        switch(JugadorInfo[playerid][jOrina])
        {
            case 50:
            {
                format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
                SendClientMessage(playerid, -1, string);
            }
            case 60:
            {
                format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 60%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
                SendClientMessage(playerid, -1, string);
            }
            case 80:
            {
                format(string, sizeof(string), "Atenciуn %s: Usted tiene un nivel de orina de 80%%, vaya a orinar o se orinarб involuntariamente.", PlayerName(playerid));
                SendClientMessage(playerid, -1, string);
            }
            case 100:
            {
                format(string, sizeof(string), "%s se orina involuntariamente, debido a que no aguantу.", PlayerName(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                JugadorInfo[playerid][jOrina] = 0;
                Orinando[playerid] = 1;
                SetPlayerSpecialAction(playerid,68);
                SendClientMessage(playerid, -1, "ЎOh! {FF0000}se ha orinado encima. {FFFFFF}Que desilusiуn, la prуxima vez evite йsto.");
                SendClientMessage(playerid, COLOR_GRAD2, "Utilice: /dorinar");
            }
        }
        return 1;
    }

    zcmd(orinar, playerid, params[])
    {
        new string[128];
        if(JugadorInfo[playerid][jOrina] >= 50) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no tiene ganas de orinar.");
        if(Orinando[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Usted ya estб orinando.");
        if(JugadorInfo[playerid][jSexo] == 1)
        {
            SetPlayerSpecialAction(playerid,68);
            JugadorInfo[playerid][jOrina] = 0;
            Orinando[playerid] = 1;
            format(string, sizeof(string), "%s se baja el cierre de su pantalуn y comienza a orinar.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
        }
        else if(JugadorInfo[playerid][jSexo] == 2)
        {
            ApplyAnimation(playerid, "ped", "SEAT_down", 4.000000, 0, 0, 0, 1, 0);
            JugadorInfo[playerid][jOrina] = 0;
            Orinando[playerid] = 1;
            format(string, sizeof(string), "%s se baja el cierre de su pantalуn, se sienta y comienza a orinar.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_GRAD2, "Para parar de orinar, utilice el comando /dorinar.");
        }
        return 1;
    }
    zcmd(dorinar, playerid, params[])
    {
        new string[128];
        if(Orinando[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Usted no estб orinando.");
        if(JugadorInfo[playerid][jSexo] == 1)
        {
            Orinando[playerid] = 0;
            ClearAnimations(playerid, 0);
            format(string, sizeof(string), "%s para de orinar y se sube el cierre de su pantalуn.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        if(JugadorInfo[playerid][jSexo] == 2)
        {
            Orinando[playerid] = 0;
            ClearAnimations(playerid, 0);
            format(string, sizeof(string), "%s para de orinar, luego se sube el cierre del pantalуn y se levanta.", PlayerName(playerid));
            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
Reply
#7

Tengo 2 warnings;

Код:
C:\Users\Dead von.PERSONAL\Desktop\LS-RG\gamemodes\lsrg.pwn(4174 -- 4175) : warning 213: tag mismatch
C:\Users\Dead von.PERSONAL\Desktop\LS-RG\gamemodes\lsrg.pwn(4486) : warning 213: tag mismatch
pawn Код:
JugadorInfo[playerid][jOrina] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100) //Lнnea 4174
JugadorInfo[playerid][jKillTimer] = SetTimerEx("ActualizarOrina", 1000, true, "i", playerid); //Lнnea 4175
pawn Код:
DestroyProgressBar(JugadorInfo[playerid][jOrina]); //Lнnea 4486

Y aъn sigue sin verse la progressbar :S їserб que el problema estб en el public payday? porque doy 5 paydays y no puedo orinar... tampoco aparecen los mensajes esos que avisan el porcentaje.
Reply
#8

JugadorInfo[playerid][jOrina] = CreateProgressBar(548.5, 36.0, _, _,, 0xDFD575FF, 100.0);

una coma de mas.

EDIT:

Tu Problema estaba aca ShowProgressBarForPlayer(playerid, barraorina[playerid]);

hay va la ke esta con CreateProgressBar
Reply
#9

Sн, medi cuenta, por eso editй el mensaje, pero ahora;

Tengo 2 warnings;

Код:
C:\Users\Dead von.PERSONAL\Desktop\LS-RG\gamemodes\lsrg.pwn(4174 -- 4175) : warning 213: tag mismatch
C:\Users\Dead von.PERSONAL\Desktop\LS-RG\gamemodes\lsrg.pwn(4486) : warning 213: tag mismatch
pawn Код:
JugadorInfo[playerid][jOrina] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100) //Lнnea 4174
JugadorInfo[playerid][jKillTimer] = SetTimerEx("ActualizarOrina", 1000, true, "i", playerid); //Lнnea 4175
pawn Код:
DestroyProgressBar(JugadorInfo[playerid][jOrina]); //Lнnea 4486

Y aъn sigue sin verse la progressbar :S їserб que el problema estб en el public payday? porque doy 5 paydays y no puedo orinar... tampoco aparecen los mensajes esos que avisan el porcentaje.
Reply
#10

JugadorInfo[playerid][jOrina] = CreateProgressBar(548.5, 36.0, _, _, 0xDFD575FF, 100); //Lнnea 4174
JugadorInfo[playerid][jKillTimer] = SetTimerEx("ActualizarOrina", 1000, true, "i", playerid); //Lнnea 4175

Falta el punto y coma ._.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)