[AJUDA] Dificuldades no sistemade veнculo
#1

Galera, nгo estou conseguindo puxar o valor do veнculo:
pawn Код:
if(strcmp(x_nr,"comprar",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[!] /v comprar [MODEL]");
                    return 1;
                }
                new veh = strval(tmp);
                if(GetPlayerMoney(playerid) < ObeterPv()) return SCM(playerid, -1, "Dinheiro insuficiente.");
            }

public ObeterPv() {
    new veh;
    if(veh == 401) return 42000;
    else if(veh == 401) return 25000;
    else if(veh == 402) return 75000;
    else if(veh == 403) return 32000;
    else if(veh == 404) return 19000;
    else if(veh == 405) return 50000;
    else return 0;
}
Ele nгo estб puxando o valor do MODEL.
Reply
#2

Vocк pode enviar o modelo do comando para a public atravйs de um parвmetro desta a fim de fazer comparaзхes entre ele e outros valores :


pawn Код:
if(strcmp(x_nr,"comprar",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[!] /v comprar [MODEL]");
                    return 1;
                }
                new veh = strval(tmp);
                if(GetPlayerMoney(playerid) < ObeterPv(veh)) return SCM(playerid, -1, "Dinheiro insuficiente.");
            }



public ObeterPv(veh) {
    if(veh == 401) return 42000;
    else if(veh == 401) return 25000; //Observaзгo: Compare a condiзгo do if dessa linha com a do da linha de cima e veja se hб algo errado.
    else if(veh == 402) return 75000;
    else if(veh == 403) return 32000;
    else if(veh == 404) return 19000;
    else if(veh == 405) return 50000;
    else return 0;
}


Espero ter ajudado .
Reply
#3

Vlw, +rep. Reparei a repetiзгo =D
Reply
#4

Ultilize switch xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)