SA-MP Forums Archive
[Ajuda] Nesse Comando - 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] Nesse Comando (/showthread.php?tid=410036)



Nesse Comando - Equipe - 24.01.2013

Bom, o comando /comprarcarro

ele vai comprando atй que chegue no MAX_CARROS = #define MAX_CARROS = 350

depois que chega, comeзa "vocк ja tem 1 carro", porque serб? alguem me fala?

codigo:

PHP код:
if(strcmp(cmdtext, "/comprarcarro", true) == 0) {
new 
VehicleID;
VehicleID = GetPlayerVehicleID(playerid);
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
for(new 
carro = 0; carro < MAX_CARROS; carro++)
{
format(string, sizeof(string), "carro%d.ini", carro);
if(!
IsPlayerInAnyVehicle(playerid)){
SendClientMessage(playerid, AMARELO, "Vocк nгo estб em um carro");
return 
1;
}
if(
strcmp(dini_Get(string, "Dono"), pname, true) == 0){
SendClientMessage(playerid, AMARELO, "Vocк jб tem um carro");
return 
1;
}
if(
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 && VehicleID == dini_Int(string, "Id")){
if(
GetPlayerGrana(playerid) >= dini_Int(string, "Preco")){
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
dini_IntSet(string, "TDono", 1);
dini_Set(string, "Dono", aname);
SendClientMessage(playerid, Violeta, "(INFO) Veiculo comprado com sucesso!");
SendClientMessage(playerid, Vermelho, "(INFO) Para ver os comandos do veiculo, use: /meucarro");
GivePlayerGrana(playerid, -dini_Int(string, "Preco"));
TogglePlayerControllable(playerid, 1);
return 
1;
} else {
SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem dinheiro suficiente!");
return 
1;
}
}
}
} 



Re: Nesse Comando - mau.tito - 24.01.2013

Acho que seria assim!
pawn Код:
if(!strcmp(pname, dini_Get(string, "Dono"), false))
            {
                SendClientMessage(playerid, AMARELO, "Vocк jб tem um carro");
                return 1;
            }