[AJUDA] Dificuldades no sistemade veнculo - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Dificuldades no sistemade veнculo (
/showthread.php?tid=315965)
[AJUDA] Dificuldades no sistemade veнculo -
felipe360 - 04.02.2012
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.
Re: [AJUDA] Dificuldades no sistemade veнculo - rjjj - 04.02.2012
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

.
Re: [AJUDA] Dificuldades no sistemade veнculo -
felipe360 - 04.02.2012
Vlw, +rep. Reparei a repetiзгo =D
Re: [AJUDA] Dificuldades no sistemade veнculo -
Ricop522 - 05.02.2012
Ultilize switch xd