SA-MP Forums Archive
split money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: split money (/showthread.php?tid=188129)



split money - Ribber - 06.11.2010

I have a clan system in my server.
Now I like to do that players who are in clans get the full amount of their gained money, while clan members gets 1/8 from it. How I can do that? Is the money splitable?


Re: split money - ViruZZzZ_ChiLLL - 06.11.2010

Well make some variables like :

pawn Код:
if(Owner[playerid] == 1)
{
  GivePlayerMoney(playerid, 10000);
}
else if(Member[playerid] == 1)
{
  GivePlayerMoney(playerid, 10000/2);
}



Re: split money - Kwarde - 06.11.2010

Like Viruzz said -> All you need to do is divide by 2
The divide sign: /, and then 2


AW: split money - Ribber - 06.11.2010

doesnt work ingame, my test command:

pawn Код:
if(strcmp(cmd,"/test",true)==0)
    {
        new money;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, _COLOR_WHITE, "Usage: /test [Money]");
            return 1;
        }
        money = strval(tmp);
        GivePlayerMoney(playerid,money/8);
        format(string,sizeof(string),"Money: %d",money/8);
        SendClientMessage(playerid,_COLOR_LIME,string);
        return 1;
    }
also you understood me wrong
not the clanowner will get the most cash, the most cash will get the player, who gained it (for killing or something).
and all other members (also the leader) will get the eight part from that gained money, while the player who gained it gets the full part.


Re: split money - MadeMan - 06.11.2010

How do you check if player is in a gang?


AW: split money - Ribber - 06.11.2010

with if(gClanRank[playerid] != 0).
What do you recommend me, the gangmembers will get recieved money, and also taken money, or only recieved money?


Re: split money - MadeMan - 06.11.2010

pawn Код:
if(strcmp(cmd,"/test",true)==0)
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, _COLOR_WHITE, "Usage: /test [Money]");
        return 1;
    }
    new money = strval(tmp);
    GivePlayerMoney(playerid,money);
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid && gClanRank[i] != 0)
        {
            GivePlayerMoney(i, money/8);
        }
    }
    format(string,sizeof(string),"Money: %d",money);
    SendClientMessage(playerid,_COLOR_LIME,string);
    return 1;
}



AW: split money - Ribber - 06.11.2010

ok ty, for checking wheter the player is in the same clan I have this:

if(GetPVarInt(playerid,"ClanID") == GetPVarInt(i,"ClanID")), so the code would be:

pawn Код:
...
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid && gClanRank[i] != 0 && GetPVarInt(playerid,"ClanID") == GetPVarInt(i,"ClanID")))
        {
            GivePlayerMoney(i, money/8);
        }
    }
...