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(playeridpnamesizeof(pname));
for(new 
carro 0carro MAX_CARROScarro++)
{
format(stringsizeof(string), "carro%d.ini"carro);
if(!
IsPlayerInAnyVehicle(playerid)){
SendClientMessage(playeridAMARELO"Vocк nгo estб em um carro");
return 
1;
}
if(
strcmp(dini_Get(string"Dono"), pnametrue) == 0){
SendClientMessage(playeridAMARELO"Vocк jб tem um carro");
return 
1;
}
if(
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == && VehicleID == dini_Int(string"Id")){
if(
GetPlayerGrana(playerid) >= dini_Int(string"Preco")){
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
dini_IntSet(string"TDono"1);
dini_Set(string"Dono"aname);
SendClientMessage(playeridVioleta"(INFO) Veiculo comprado com sucesso!");
SendClientMessage(playeridVermelho"(INFO) Para ver os comandos do veiculo, use: /meucarro");
GivePlayerGrana(playerid, -dini_Int(string"Preco"));
TogglePlayerControllable(playerid1);
return 
1;
} else {
SendClientMessage(playeridVermelho"(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;
            }