[Ajuda] Random
#1

Bom eu tentei colocar um random de valores para roubo e dei esses avisos tentei arrumar num consegui

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72783) : warning 213: tag mismatch
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72793) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          12500 bytes
Code size:          3114432 bytes
Data size:          7387176 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:10530492 bytes

2 Warnings.
pawn Код:
forward StealingTimer();
public StealingTimer()
{
    for(new i = 1; i < MAX_ROBS; i ++)
    {
        if(Rob[i][Stealing] == true)
        {
            if(PlayerToPoint(30.0, Rob[i][Robber], Rob[i][CoordX], Rob[i][CoordY], Rob[i][CoordZ]))
            {
                Rob[i][RobStep] ++;
                if(Rob[i][RobStep] == 9)
                {
                    new randCU = random(sizeof(ROB_CASH));
                    Rob[i][CanSteal] = false;
                    SetTimerEx("AllowSteal",15*60000, false,"i", i);
                    GivePlayerGP(Rob[i][Robber], ROB_CASH[randCU][0]);//linha 72783
                    new string[128];
                    format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre. Fuja logo daqui!", ROB_CASH[randCU][0]);
                    SendClientMessage(Rob[i][Robber], COLOR_GREEN, string);

                    for(new x = 0; x <= HighestID; x ++)
                    {
                        if(IsPlayerConnected(x) && x != Rob[i][Robber] && gTeam[x] == gTeam[Rob[i][Robber]] && PlayerToPoint(30.0, x, Rob[i][CoordX], Rob[i][CoordY], Rob[i][CoordZ]))
                        {
                            SetPlayerCriminal(x,255,"Cumplice de assalto");
                            GivePlayerGP(x, ROB_CASH[randCU][0]);//linha 72793
                            format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre como cъmplice. Fuja logo daqui!", ROB_CASH[randCU][0]);
                            SendClientMessage(x, COLOR_GREEN, string);
                            WantedPoints[x] ++;
                        }
                    }
                    Rob[i][Robber] = INVALID_PLAYER_ID;
                    Rob[i][RobStep] = 0;
                    Rob[i][Stealing] = false;
                }
            }
            else
            {
                SendClientMessage(Rob[i][Robber], COLOR_GREY,"[ERRO] Roubo cancelado, vocк se distanciou do cofre.");
                Rob[i][CanSteal] = false;
                Rob[i][Robber] = INVALID_PLAYER_ID;
                Rob[i][RobStep] = 0;
                Rob[i][Stealing] = false;
            }
        }
    }
    return 1;
}
Reply
#2

Tira o [0] no final dos dois.
Reply
#3

e coloca que oq ?
hue
Reply
#4

Nada. Sу tira o [0].
Reply
#5

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72782) : error 029: invalid expression, assumed zero
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72792) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#6

O que essa GivePlayerGP faz ?

--

Tem bastante erro nesse code ai em jovem. A quantidade de grana nгo estб definida, ele pode receber tanto 1 R$ quanto 999999 R$.
Reply
#7

Esquece o GivePlayerGP ele й mesmo que GivePlayerMoney, mas й criado com textdraw e fica em baixo do Life!
Reply
#8

Nossa eu falei merda. O [0] й pra ser usado no random mesmo.

Tente:

randCU[0] = 100 * 10000;

Isso й pra ser colocado debaixo do new randCU.
Reply
#9

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72780) : error 028: invalid subscript (not an array or too many subscripts): "randCU"
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72780) : warning 215: expression has no effect
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72780) : error 001: expected token: ";", but found "]"
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72780) : error 029: invalid expression, assumed zero
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72780) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#10

randCU = 1000 + random(1000);

Lembrando que й pra botar o [0] dnv lб.
Reply
#11

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72783) : warning 213: tag mismatch
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72793) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          12500 bytes
Code size:          3114500 bytes
Data size:          7387176 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:10530560 bytes

2 Warnings.
pawn Код:
Rob[i][RobStep] ++;
                if(Rob[i][RobStep] == 9)
                {
                    new randCU = random(sizeof(ROB_CASH));
                    randCU = 1000 + random(1000);
                    Rob[i][CanSteal] = false;
                    SetTimerEx("AllowSteal",15*60000, false,"i", i);
                    GivePlayerMoney(Rob[i][Robber], ROB_CASH[randCU][0]);//linha 72783
                    new string[128];
                    format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre. Fuja logo daqui!", ROB_CASH[randCU][0]);
                    SendClientMessage(Rob[i][Robber], COLOR_GREEN, string);

                    for(new x = 0; x <= HighestID; x ++)
                    {
                        if(IsPlayerConnected(x) && x != Rob[i][Robber] && gTeam[x] == gTeam[Rob[i][Robber]] && PlayerToPoint(30.0, x, Rob[i][CoordX], Rob[i][CoordY], Rob[i][CoordZ]))
                        {
                            SetPlayerCriminal(x,255,"Cumplice de assalto");
                            GivePlayerMoney(x, ROB_CASH[randCU][0]);//linha 72793
                            format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre como cъmplice. Fuja logo daqui!", ROB_CASH[randCU][0]);
                            SendClientMessage(x, COLOR_GREEN, string);
                            WantedPoints[x] ++;
                        }
                    }
                    Rob[i][Robber] = INVALID_PLAYER_ID;
                    Rob[i][RobStep] = 0;
                    Rob[i][Stealing] = false;
                }
            }
Reply
#12

Agora vamos бs perguntas.

Robber й o cara que estб assaltando ?
Robstep й oque ? E Stealing ?
Reply
#13

ai vocк me aperto sem me abraзar!
pawn Код:
enum rob_data
{
    bool:CanSteal,
    bool:Stealing,
    LocName[24],
    Robber,
    Float:CoordX,
    Float:CoordY,
    Float:CoordZ,
    RobStep
}
Reply
#14

Cara, isso aн й sу a definiзгo. Quero saber qual valor ela assume..
Reply
#15

Nгo sei te falar ...

tipo isso ?
pawn Код:
else if(Rob[robid][Stealing] == true)
            return SendClientMessage(playerid, COLOR_RED,"[ERRO] O cofre jб estб sendo roubado.");
Reply
#16

Tenta:

pawn Код:
GivePlayerMoney(x, sizeof([randCU][0]));
Reply
#17

pawn Код:
else if(Rob[robid][Stealing] == true)
            return SendClientMessage(playerid, COLOR_RED,"[ERRO] O cofre jб estб sendo roubado.");
        else
        {
            GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
            format(string, 128, "[Seguranзa] As camкras de seguranзa flagraram %s roubando o %s.", giveplayer, Rob[robid][LocName]);
            SendClientMessageToAll(COLOR_RED, string);
            WantedPoints[playerid] += 2;
            SendClientMessage(playerid, COLOR_WHITE,"** Vocк estб abrindo o cofre...aguarde!");
            SendClientMessage(playerid, COLOR_GOLD,"[INFO] O roubo leva em torno de 90 segundos, fique prуximo do cofre.");
            format(string,128,"Assalto ao %s", Rob[robid][LocName]);
            SetPlayerCriminal(playerid,255,string);
            Rob[robid][Robber] = playerid;
            Rob[robid][Stealing] = true;
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
        }
Reply
#18

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72781) : error 017: undefined symbol "x"
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72781) : error 020: invalid symbol name ""
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72781) : warning 215: expression has no effect
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72781) : error 001: expected token: ";", but found "]"
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72781) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#19

Sem saber o valor vai ficar dificil...
Reply
#20

Quote:
Originally Posted by BaianoIn
Посмотреть сообщение
Bom eu tentei colocar um random de valores para roubo e dei esses avisos tentei arrumar num consegui

pawn Код:
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72783) : warning 213: tag mismatch
C:\Users\User\Documents\Leonardo R\New server noiz dois\gm by master_pawnaaaaaaa\gm by master_pawn\Brasil Gold Revolution RP\gamemodes\BGR.pwn(72793) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:          12500 bytes
Code size:          3114432 bytes
Data size:          7387176 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:10530492 bytes

2 Warnings.
pawn Код:
forward StealingTimer();
public StealingTimer()
{
    for(new i = 1; i < MAX_ROBS; i ++)
    {
        if(Rob[i][Stealing] == true)
        {
            if(PlayerToPoint(30.0, Rob[i][Robber], Rob[i][CoordX], Rob[i][CoordY], Rob[i][CoordZ]))
            {
                Rob[i][RobStep] ++;
                if(Rob[i][RobStep] == 9)
                {
                    new randCU = random(sizeof(ROB_CASH));
                    Rob[i][CanSteal] = false;
                    SetTimerEx("AllowSteal",15*60000, false,"i", i);
                    GivePlayerGP(Rob[i][Robber], ROB_CASH[randCU][0]);//linha 72783
                    new string[128];
                    format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre. Fuja logo daqui!", ROB_CASH[randCU][0]);
                    SendClientMessage(Rob[i][Robber], COLOR_GREEN, string);

                    for(new x = 0; x <= HighestID; x ++)
                    {
                        if(IsPlayerConnected(x) && x != Rob[i][Robber] && gTeam[x] == gTeam[Rob[i][Robber]] && PlayerToPoint(30.0, x, Rob[i][CoordX], Rob[i][CoordY], Rob[i][CoordZ]))
                        {
                            SetPlayerCriminal(x,255,"Cumplice de assalto");
                            GivePlayerGP(x, ROB_CASH[randCU][0]);//linha 72793
                            format(string, sizeof(string), "[SUCESSO] Vocк conseguiu retirar R$%d do cofre como cъmplice. Fuja logo daqui!", ROB_CASH[randCU][0]);
                            SendClientMessage(x, COLOR_GREEN, string);
                            WantedPoints[x] ++;
                        }
                    }
                    Rob[i][Robber] = INVALID_PLAYER_ID;
                    Rob[i][RobStep] = 0;
                    Rob[i][Stealing] = false;
                }
            }
            else
            {
                SendClientMessage(Rob[i][Robber], COLOR_GREY,"[ERRO] Roubo cancelado, vocк se distanciou do cofre.");
                Rob[i][CanSteal] = false;
                Rob[i][Robber] = INVALID_PLAYER_ID;
                Rob[i][RobStep] = 0;
                Rob[i][Stealing] = false;
            }
        }
    }
    return 1;
}

Cria um novo randow...
pawn Код:
new grana = 2500+random(2500);

GivePlayerGP(x, grana);//linha 72793
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)