[Ajuda] Venda de carro
#1

Vou liberar o /conce pra compra veiculo do lugar onde tiver, Eu ja tinha feito isso, Mais as pessoas nao sabem q tem como mudar o modelo do carro pelo /meucarro, Ai elas vendem e comprao outro carro ate achar o que querem, Ai fica akele monte de carro espalhado pelo mapa, Eu queria uma ajuda pra quando as pessoas venderem o carro ele ser deletado.

PHP код:
if(listitem == 7)                      // Vender Carro
            
{
                new 
VehicleID GetPlayerVehicleID(playerid);
                for(new 
carro 0carro MAX_CONCEScarro++)
                {
                    
format(stringsizeof(string), PASTA_CONCEcarro);
                    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == && VehicleID == dini_Int(string"Id"))
                    {
                        if(
IsPlayerConnected(playerid))
                        {
                            if(
strcmp(dini_Get(string"Dono"), GetPlayerNameEx(playerid), false) == 0)
                            {
                                
dini_Set(string"Dono""Ninguem");
                                
dini_IntSet(string"TDono"0);
                                
dini_IntSet(string"CarVIP"0);
                                
GivePlayerGrana(playeriddini_Int(string"Preco"));
                                
format(stringsizeof(string), "%s vendeu um veнculo. Local: %s"GetPlayerNameEx(playerid), GetPlayerArea(playerid));
                                
SendClientMessageToAll(Azulstring);
                                return 
1;
                            }
                            else
                            {
                                
SendClientMessage(playeridVermelho"Este veнculo nгo й seu!");
                                return 
1;
                            }
                        }
                    }
                }
                
SendClientMessage(playeridVermelho"Vocк precisa estar dentro de seu veнculo para vende-lo.");
            } 
Reply
#2

Alguem? ;-;
Reply
#3

Tenta colocar algo tipo:

pawn Код:
if(listitem == 7) // Vender Carro
            {
                new VehicleID = GetPlayerVehicleID(playerid);
                for(new carro = 0; carro < MAX_CONCES; carro++)
                {
                    format(string, sizeof(string), PASTA_CONCE, carro);
                    if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0 && VehicleID == dini_Int(string, "Id"))
                    {
                        if(IsPlayerConnected(playerid))
                        {
                            if(strcmp(dini_Get(string, "Dono"), GetPlayerNameEx(playerid), false) == 0)
                            {
                                DestroyVehicle(VehicleID);
                                GivePlayerGrana(playerid, dini_Int(string, "Preco"));
                                dini_Remove(carro);
                                return 1;
                            }
                            else
                            {
                                SendClientMessage(playerid, Vermelho, "Este veнculo nгo й seu!");
                                return 1;
                            }
                        }
                    }
                }
                SendClientMessage(playerid, Vermelho, "Vocк precisa estar dentro de seu veнculo para vende-lo.");
            }
Espero ter ajudado (:

Atenciosamente,
Reply
#4

Deu esses erro aki

PHP код:
C:\Documents and Settings\Luis Paulo\Desktop\[BvSBrasil Vida Social\gamemodes\Dten03x.pwn(2071) : warning 217loose indentation
C
:\Documents and Settings\Luis Paulo\Desktop\[BvSBrasil Vida Social\gamemodes\Dten03x.pwn(24342) : error 035argument type mismatch (argument 1)
C:\Documents and Settings\Luis Paulo\Desktop\[BvSBrasil Vida Social\gamemodes\Dten03x.pwn(10336) : warning 204symbol is assigned a value that is never used"Chatlb" 
Reply
#5

Alguem ajuda pfv..
Reply
#6

Pode mandar o /comprarcarro? Vou tentar te ajudar.
Reply
#7

PHP код:
if(strcmp("/comprarcarro"cmdtrue) == 0)
    {
        new 
conceid;
        if(
sscanf(cmdtext"s[14]d"cmdconceid))
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
                for(new 
carro 0carro MAX_CONCEScarro++)
                {
                    
format(filesizeof(file), PASTA_CONCEcarro);
                    if(
dini_Exists(file))
                    {
                        if(
GetPlayerVehicleSeat(playerid) == && GetPlayerVehicleID(playerid) == dini_Int(file"Id"))
                        {
                            if(
dini_Int(file"TDono") == 0)
                            {
                                if(
GetPlayerGrana(playerid) >= dini_Int(file"Preco"))
                                {
                                    if(
GetCarros(playerid) < MAX_PLAYER_CONCE)
                                    {
                                        
dini_IntSet(file"TDono"1);
                                        
dini_Set(file"Dono"GetPlayerNameEx(playerid));
                                        if(!
IsPlayerVIP(playerid))
                                        {
                                            
GivePlayerGrana(playerid, -dini_Int(file"Preco"));
                                            
TogglePlayerControllable(playerid1);
                                            
dini_IntSet(file"CarVIP"0);
                                            
intest[playerid] = 0;
                                            
format(stringsizeof(string), "%s comprou um carro, deve estar feliz!"GetPlayerNameEx(playerid));
                                            
SendClientMessageToAll(roxostring);
                                            
ClearChatbox(playerid1);
                                            
SendClientMessage(playeridAzul"  Veнculo comprado com sucesso!");
                                            
SendClientMessage(playeridAzul"  Para ver os comandos do veнculo, use: /meucarro");
                                            
SendClientMessage(playeridLARANJA"|___________________________________________________________|");
                                        }
                                        else
                                        {
                                            
GivePlayerGrana(playerid, -dini_Int(file"Preco"));
                                            
TogglePlayerControllable(playerid1);
                                            
dini_IntSet(file"CarVIP"1);
                                            
intest[playerid] = 0;
                                            
format(stringsizeof(string), "%s comprou um carro equipado com alarme explosivo."GetPlayerNameEx(playerid));
                                            
SendClientMessageToAll(roxostring);
                                            
ClearChatbox(playerid1);
                                            
SendClientMessage(playeridAzul"  Veнculo comprado com sucesso!");
                                            
SendClientMessage(playeridAmarelo"  (VIP) Seu carro foi equipado com alarme explosivo.");
                                            
SendClientMessage(playeridAzul"  Para ver os comandos do veнculo, use: /meucarro");
                                            
SendClientMessage(playeridLARANJA"|___________________________________________________________|");
                                        }
                                        return 
1;
                                    }
                                    else
                                    {
                                        
SendClientMessage(playeridAmarelo"Vocк sу pode ter "#MAX_PLAYER_CONCE" carros!");
                                        
SendClientMessage(playeridVermelho"Para comprar outro venda um de seus!");
                                        return 
1;
                                    }
                                }
                                else
                                {
                                    
SendClientMessage(playeridVermelho"Vocк nгo tem dinheiro suficiente!");
                                    return 
1;
                                }
                            }
                            else
                            {
                                
SendClientMessage(playeridVermelho"Este veнculo nгo estб a venda!");
                                return 
1;
                            }
                        }
                    }
                }
            }
            
SendClientMessage(playeridVermelho"Use /comprarcarro [conceid]");
            return 
1;
        } 
Reply
#8

Gostaria de ter ajudado, mais nгo deu..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)