[Ajuda] Pagamento Randфmico
#1

Galera estou a 45645646 dias nesse forum samp tentando fazer um pagamento randфmico pra profissao de caminhoneiro do meu servidor, mas, o tempo de resposta й de 654654 dias, e todo mundo responde pela metade, e o code nunca da certo, trava atй o pawn, sera que alguem que realmente entenda de coisas randфmicas pode me ajudar? eu ficaria muito grato, muito.

https://sampforum.blast.hk/showthread.php?tid=446457
Reply
#2

pawn Код:
new pagamento = random[10000];
GivePlayerMoney(playerid, pagamento);
Reply
#3

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
pawn Код:
new pagamento = random[10000];
GivePlayerMoney(playerid, pagamento);
Cara, respondeu pela metade de novo! e o resto do code?

e esse valor ae? 10000? eu nao quero somente 10000, eu quero vбrios valores como:
pawn Код:
static Float:Pagamento[][] =//-Pagamento Caminhoneiro
{
    {1500},
    {1622},
    {1757},
    {1800},
    {1854},
    {1932},
    {2000}
};
por isso que jб й randфmico entende?
Reply
#4

Testa ai o sistema!

pawn Код:
//Topo
new GranaDescarregar[][] ={
    "1500",
    "1622",
    "1757",
    "1790",
    "1800",
    "1854",
    "2000"
};
//Forward
forward DarGranaDescarregar(playerid);
//public
public DarGranaDescarregar(playerid){
    new random = random(sizeof(GranaDescarregar));
    GivePlayerMoney(playerid,GranaDescarregar);
    return 1;
}
//Comando
    if(strcmp(cmdtext, "/Descarregar", true) == 0)
    {
        if(!PlayerToPoint(40.0, playerid, -1013.5171,-639.6732,32.0078))
            return SendClientMessage(playerid, 0xFF0000AA, "(ERRO) Vocк nгo estб na area de descarregamento!");
        if(Profissao[playerid] != PROF_CAMINHONEIRO)
            return SendClientMessage(playerid, 0xFF0000AA, "(ERRO) Vocк nгo й um caminhoneiro!");
        if(Carga[playerid] == 0)
            return SendClientMessage(playerid, 0xFF0000AA, "(ERRO) Vocк nгo tem uma carga!");
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 515)
            return SendClientMessage(playerid, 0xFF0000AA, "(ERRO) Vocк nгo estб em um Roadtrain.");
        Carga[playerid] = 0;
        SendClientMessage(playerid, 0xFFA4A4AA, "(INFO) Caminhгo descarregado com sucesso!");
        SendClientMessage(playerid, 0xFFA4A4AA, "(INFO) O dono da empresa de carregamento lhe pagou um bфnus pelo serviзo! (R$700)");
        DarGranaDescarregar(playerid);
        return 1;
    }
Reply
#5

D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : warning 219: local variable "random" shadows a variable at a preceding level
D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : error 012: invalid function call, not a valid address
D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : error 001: expected token: ";", but found "sizeof"
D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : warning 215: expression has no effect
D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : error 001: expected token: ";", but found ")"
D:\Users\-------\Desktop\-------\gamemodes\-------RPG.pwn(956 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

9568: new random = random(sizeof(GranaDescarregar));
Reply
#6

Troque a antiga public por essa

pawn Код:
public DarGranaDescarregar(playerid){
    new random = random(sizeof(GranaDescarregar));
    GivePlayerMoney(playerid,GranaDescarregar[random]);
    return 1;
}
Reply
#7

Quote:
Originally Posted by Cidiei
Посмотреть сообщение
Troque a antiga public por essa

pawn Код:
public DarGranaDescarregar(playerid){
    new random = random(sizeof(GranaDescarregar));
    GivePlayerMoney(playerid,GranaDescarregar[random]);
    return 1;
}
------------------------------------------RPG.pwn(9567) : warning 219: local variable "random" shadows a variable at a preceding level
------------------------------------------RPG.pwn(9567) : error 012: invalid function call, not a valid address
------------------------------------------RPG.pwn(9567) : error 001: expected token: ";", but found "sizeof"
------------------------------------------RPG.pwn(9567) : warning 215: expression has no effect
------------------------------------------RPG.pwn(9567) : error 001: expected token: ";", but found ")"
------------------------------------------RPG.pwn(9567) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

9567: new random = random(sizeof(GranaDescarregar));
Reply
#8

pawn Код:
new MyRandom = random ( sizeof ( GranaDescarregar ) ) ;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)