SA-MP Forums Archive
[AJUDA] - 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] (/showthread.php?tid=176710)



[AJUDA] Dinheiro secundario - addonloko - 14.09.2010

Olб pessoa, baixei um game mode muito bom mas estou tendo alguns problemas coom ela pois quando tento comprar algo de um FS nгo funciona fala que nгo tenho dinheiro por causa da moeda secundaria, alguem poderia me ajudar a configura o FS para que de para comprar com o dinheiro secundario, agradeзo desde jб.




Codigo do FS
Код:
#include <a_samp>

#define MAX_RENT_VEHICLES 50 //coloque aqui o mбximo de veнclos que pode colocar pra alugar

forward VerificarVeiculos();

new RentVehicle[MAX_RENT_VEHICLES];
new VehiclePrice[MAX_VEHICLES];
new VehicleOwner[MAX_VEHICLES][MAX_PLAYER_NAME];
new VehicleName[MAX_VEHICLES][MAX_PLAYER_NAME];
new rentid;

stock AddRentableVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, price, name[])
{
    RentVehicle[rentid] = CreateVehicle(modelid, x, y, z, angle, color1, color2, 6000);
    if(!RentVehicle[rentid] || !price || !name[0]) return -1;
    VehiclePrice[RentVehicle[rentid]] = price;
    strmid(VehicleName[RentVehicle[rentid]], name, 0, strlen(name));
    return rentid++;
}

stock bool:IsVehicleRentable(vehicleid)
{
    for(new i; i < MAX_RENT_VEHICLES; i++)
        if(RentVehicle[i] == vehicleid)
            return true;
    return false;
}

stock SetVehicleOwner(vehicleid, owner[])
{
    if(!IsVehicleRentable(vehicleid)) return 0;
    strmid(VehicleOwner[vehicleid], owner, 0, strlen(owner));
    return 1;
}

stock GetVehicleOwner(vehicleid, destine[])
{
    if(!IsVehicleRentable(vehicleid) || !VehicleOwner[vehicleid][0])
    {
        format(destine, 8, "ninguem");
        return 0;
    }
    format(destine, strlen(VehicleOwner[vehicleid]), "%s", VehicleOwner[vehicleid]);
    return 1;
}

stock bool:IsVehicleOwned(vehicleid)
{
    return !VehicleOwner[vehicleid][0] || !IsVehicleRentable(vehicleid) ? false : true;
}

stock bool:IsPlayerVehicleOwner(playerid, vehicleid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof pname);
    return !strcmp(VehicleOwner[vehicleid], pname, false);
}

public OnFilterScriptInit()
{
    printf("FS de Concessionaria [www.HomeHots.blogspot.com]");
    AddRentableVehicle(555, 2149.5, -1134.0, 25.4, 270.15, 1, 1, 20000, "este Carro");
    AddRentableVehicle(411, 2149.0, -1136.1, 25.4, 270.15, 1, 1, 50000, "este Carro");
    //e assim por diante...
    SetTimer("VerificarVeiculos", 5000, 1);
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(IsVehicleRentable(vehicleid))
        {
            new string[128], owner[MAX_PLAYER_NAME];
            TogglePlayerControllable(playerid, false);
            GetVehicleOwner(vehicleid, owner);
            if(!IsVehicleOwned(vehicleid))
            {
                format(string, sizeof string, "Compre %s por apenas %d reais! Digite: /comprar",
                    VehicleName[vehicleid], VehiclePrice[vehicleid]);
            } else if(IsPlayerVehicleOwner(playerid, vehicleid))
            {
                TogglePlayerControllable(playerid, true);
                format(string, sizeof string, "|__________|  Bem vindo a seu veнculo %s.  |__________|", owner);
            } else {
                format(string, sizeof string, "%s, йste carro nгo й seu, ele pertence а %s.",
                    VehicleName[vehicleid], owner);
            }
            SendClientMessage(playerid, 0xFFFFFFAA, string);
        }
    }
    return 1;
}

public VerificarVeiculos()
{
    for(new i; i < MAX_VEHICLES; i++)
    {
        if(GetVehicleModel(i) < 400 && GetVehicleModel(i) > 612 && IsVehicleRentable(i))
        {
            for(new j = i; j < MAX_RENT_VEHICLES; j++)
            {
                VehiclePrice[j] = VehiclePrice[j+1];
                VehicleName[j] = VehicleName[j+1];
                VehicleOwner[j] = VehicleOwner[j+1];
            }
            rentid--;
        }
    }
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/comprar", true))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(!vehicleid)
        {
            SendClientMessage(playerid, 0xFF0000AA, "Vб para a concessionaria e compre seu veнculo");
            return 1;
        }
        new string[128];
        if(!IsVehicleOwned(vehicleid))
        {
            if(GetPlayerMoney(playerid) >= VehiclePrice[vehicleid])
            {
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(playerid, pname, sizeof pname);
                SetVehicleOwner(vehicleid, pname);
                GivePlayerMoney(playerid, -VehiclePrice[vehicleid]);
                TogglePlayerControllable(playerid, true);
                format(string, sizeof string, "Agora %s й seu!", VehicleName[vehicleid]);
                SendClientMessage(playerid, 0xFFFFFFAA, string);
            } else {
                format(string, sizeof string, "Vocк nгo tem %d R$!", VehiclePrice[vehicleid]);
                SendClientMessage(playerid, 0xFF0000AA, string);
                return 1;
            }
        } else if(IsPlayerVehicleOwner(playerid, vehicleid))
        {
            format(string, sizeof string, "Vocк jб й dono d%s!", VehicleName[vehicleid]);
            SendClientMessage(playerid, 0xFF0000AA, string);
        } else {
            new owner[MAX_PLAYER_NAME];
            GetVehicleOwner(vehicleid, owner);
            format(string, sizeof string, "%, este carro pertence а %s.", VehicleName[vehicleid], owner);
            SendClientMessage(playerid, 0xFF0000AA, string);
        }
        return 1;
    }
    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == 16 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(IsVehicleRentable(GetPlayerVehicleID(playerid)))
        {
            TogglePlayerControllable(playerid, true);
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}



Re: [AJUDA] - Canabis - 14.09.2010

moeda segundaria й coisa de noob...
usa um anti money hack...
tem varios aki na area BR

https://sampforum.blast.hk/showthread.php?tid=130458

mais eu recomendo essa que й a mais facil de usar...


Re: [AJUDA] - Shelby - 14.09.2010

Nгo tem como vocк colocar moeda secundбria em um filterscript e em um gamemode e funcionarem juntas.

Mas, vocк pode optar por esta include:

PDS - Protioso Dinheiro Secundбrio

Troque o dinheiro do Gamemode e do Filterscript que irгo funcionar simultaneamente. creio eu

Quote:

moeda segundaria й coisa de noob...
usa um anti money hack...
tem varios aki na area BR

Discordo... Nгo acho moeda secundбria coisa de n00b, acho muito melhor que a moeda original do jogo pois й 100% mais segura, sу nгo gosto de textdraw separado do dinheiro do jogo, por isso prefiro a moeda secundбria no prуprio HUD do jogo.

Off: Praticamente todo tуpico que eu respondo estou colocando include do Protioso LOL. nгo sou gay


Re: [AJUDA] - Canabis - 14.09.2010

Quote:
Originally Posted by Larceny
Посмотреть сообщение
Nгo tem como vocк colocar moeda secundбria em um filterscript e em um gamemode e funcionarem juntas.

Mas, vocк pode optar por esta include:

PDS - Protioso Dinheiro Secundбrio

Troque o dinheiro do Gamemode e do Filterscript que irгo funcionar simultaneamente. creio eu



Discordo... Nгo acho moeda secundбria coisa de n00b, acho muito melhor que a moeda original do jogo pois й 100% mais segura, sу nгo gosto de textdraw separado do dinheiro do jogo, por isso prefiro a moeda secundбria no prуprio HUD do jogo.

Off: Praticamente todo tуpico que eu respondo estou colocando include do Protioso LOL. nгo sou gay
pra min vc й noob...
se vc criar um anti money hack vc nгo tera problemas com a moeda do jogo
e podera usar ela em varios FS sem editar a moeda do FS
fica se matando com moeda segundaria enquanto meu anti money hack ta banindo os hackers!


Re: [AJUDA] - Shelby - 14.09.2010

Quote:

pra min vc й noob...
se vc criar um anti money hack vc nгo tera problemas com a moeda do jogo
e podera usar ela em varios FS sem editar a moeda do FS
fica se matando com moeda segundaria enquanto meu anti money hack ta banindo os hackers!

Nгo quero entrar em discussгo, sу expressei minha opiniгo.


Re: [AJUDA] - Canabis - 14.09.2010

eu tam bem expressei minha opiniao...
desculpa ae xD


Re: [AJUDA] - addonloko - 14.09.2010

Alguem poderia me dizer como retirar, essa moeda secundaria?


Re: [AJUDA] - sergio_xd - 14.09.2010

ela deve usar algun public sei la vocк tem que olhar melhor isso.


Respuesta: [AJUDA] - ipsBruno - 15.09.2010

https://sampforum.blast.hk/showthread.php?tid=130458 = Bugado
Dinheiro Secundбrio = Coisa Horrнvel

Peguem minha Inc ou do SubZero!
https://sampforum.blast.hk/showthread.php?tid=167076