split money
#1

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?
Reply
#2

Well make some variables like :

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

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

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.
Reply
#5

How do you check if player is in a gang?
Reply
#6

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

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;
}
Reply
#8

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);
        }
    }
...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)