SA-MP Forums Archive
[Ajuda] Vender carro inativos - 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] Vender carro inativos (/showthread.php?tid=525674)



Vender carro inativos - victorlus - 13.07.2014

Olб galera do forum samp eu queria uma funзгo que vendia todos carros off line que o dono nгo loga a mais de 3 meses

Funзгo vender carro 1 por 1:
PHP код:
 if(!strcmp(cmdtext"/avendercarro"true))
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] >= DONO)
    {
    if(
admtrampando[playerid] < && PlayerInfo[playerid][pAdmin] != DONO)
        {
            
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo estб trabalhando! (/trabalhar)");
            return 
1;
        }
                new 
Float:x,Float:y,Float:z;
                 new 
Float:a;
                 
CarInfo[vehid][cOwned] = 0;
                 
strmid(CarInfo[vehid][cOwner], "Dealership"0strlen("Dealership"), 999);
                 
PlayerPlaySound(playerid10520.00.00.0);
                 
GameTextForPlayer(playerid"~w~Voce vendeu o veiculo!"100003);
                 
GetVehiclePos(vehidxyz);
                 
GetVehicleZAngle(vehida);
                 
CarInfo[vehid][cLocationx] = x;
                 
CarInfo[vehid][cLocationy] = y;
                 
CarInfo[vehid][cLocationz] = z;
                 
CarInfo[vehid][cAngle] = a
                
TaCongelado[playerid] = false;
                 
RemovePlayerFromVehicle(playerid);
                 
TogglePlayerControllable(playerid1);
                 
format(CarInfo[vehid][cLicense], 32 ,"АVenda");
                
SetVehicleNumberPlate(vehid,CarInfo[vehid][cLicense]);
                 
OnPropUpdate2(); SavePlayerData(playerid);
                 
DestroyVehicle(vehid);
                new 
thiscar CreateVehicle(CarInfo[vehid][cModel],CarInfo[vehid][cLocationx],CarInfo[vehid][cLocationy],CarInfo[vehid][cLocationz]+1.0,CarInfo[vehid][cAngle],CarInfo[vehid][cColorOne],CarInfo[vehid][cColorTwo],60000);
                
LoadComponents(thiscar);
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo estб autorizado a usar esse comando !");
                return 
1;
            }
        }
        return 
1;
    } 



Re: Vender carro inativos - SW1FTmeister - 13.07.2014

Penso que seria um sistema bastante complexo, o servidor teria de, automaticamente, atribuir meses а conta do jogador, mesmo com ele offline.

Caso consiga, no OnGamemodeInit teria de colocar um check, por exemplo, com dini_Get com uma loop por todos os ficheiros das contas e procurar onde diz "MesesAFK=3" (por exemplo) e depois dava o tal delete nos veнculos.