Jump to content

Money help


matttu

Recommended Posts

Hey community!

I've got a problem with adding money for group.

I want to make it so, if you want to make a group, you'll need 5000$

I just need some instructions ^^

function createGroupForPlayer (playersource,command,...) 
    local teamName = table.concat({...}, " ") 
    if not isGuestAccount(getPlayerAccount(playersource)) and getElementData(playersource,"gang") == "None" then 
        if teamName then 
            if not isGangExisting (teamName) then 
            addGang (teamName,getAccountName(getPlayerAccount(playersource))) 
            setAccountData(getPlayerAccount(playersource),"gangslots",12) 
            outputChatBox ("#FFFFFFYou successfully created your group with the name of: "..teamName..".",playersource,27, 89, 224,true)     
            else 
                outputChatBox ("#FFFFFFThere is a group with this name already!",playersource,27, 89, 224,true)  
            end 
        else 
            outputChatBox ("#FFFFFFSyntax is /creategroup !",playersource,27, 89, 224,true)    
        end 
    else 
        outputChatBox ("#FFFFFFYou are in a group already!",playersource,27, 89, 224,true)       
    end 
end 
addCommandHandler("creategroup",createGroupForPlayer) 

Link to comment

First I did this, i know it is wrong, but I didn't know where to start aswell, so I just tried this.

function createGroupForPlayer (playersource,command,...) 
    local teamName = table.concat({...}, " ") 
    local money = getPlayerMoney(playersource) 
    if (money > 4999) then 
 takePlayerMoney(5000) 
    if not isGuestAccount(getPlayerAccount(playersource)) and getElementData(playersource,"gang") == "None" then 
        if teamName then 
            if not isGangExisting (teamName) then 
            addGang (teamName,getAccountName(getPlayerAccount(playersource))) 
            setAccountData(getPlayerAccount(playersource),"gangslots",12) 
            outputChatBox ("#FFFFFFYou successfully created your group with the name of: "..teamName..".",playersource,27, 89, 224,true)     
            else 
                outputChatBox ("#FFFFFFThere is a group with this name already!",playersource,27, 89, 224,true)  
            end 
        else 
            outputChatBox ("#FFFFFFSyntax is /creategroup !",playersource,27, 89, 224,true)    
        end 
    else 
        outputChatBox ("#FFFFFFYou are in a group already!",playersource,27, 89, 224,true)       
    end 
end 
end 
addCommandHandler("creategroup",createGroupForPlayer) 

but it broke, so i did the second

local money = getPlayerMoney(playersource) 
if money = 5000 then takePlayerMoney(5000)  

it worked, but it didn't take money.

Maybe you could give me some more information about this, I don't want anyone to tell me exactly how or make this for me, I would like to start learning it and this is where I start. :)

Link to comment

Well, it broke like that, when I try insert the command it doesn't do anything.

but I tried this way aswell, but still nothing. :/

function createGroupForPlayer (playersource,command,...) 
    local teamName = table.concat({...}, " ") 
    local money = getPlayerMoney(playersource) 
    if not isGuestAccount(getPlayerAccount(playersource)) and getElementData(playersource,"gang") == "None" then 
        if teamName then 
            if not isGangExisting (teamName) then 
            addGang (teamName,getAccountName(getPlayerAccount(playersource))) 
            setAccountData(getPlayerAccount(playersource),"gangslots",12) 
            outputChatBox ("#FFFFFFYou successfully created your group with the name of: "..teamName..".",playersource,27, 89, 224,true)     
            else 
                outputChatBox ("#FFFFFFThere is a group with this name already!",playersource,27, 89, 224,true)  
            end 
        else 
            outputChatBox ("#FFFFFFSyntax is /creategroup !",playersource,27, 89, 224,true)    
        end 
    else 
        outputChatBox ("#FFFFFFYou are in a group already!",playersource,27, 89, 224,true) 
      if (money > 4999) then 
      takePlayerMoney(playersource, 5000) 
      else 
      return 
      outputChatBox ("#FFFFFFYou don't have enough money to create a group! [Kill more zombies]",playersource,27, 89, 224,true) 
    end 
end 
end 
addCommandHandler("creategroup",createGroupForPlayer) 

Link to comment
function createGroupForPlayer (playersource,command,...) 
    local teamName = table.concat({...}, " ") 
    local money = getPlayerMoney(playersource) 
    if not isGuestAccount(getPlayerAccount(playersource)) and getElementData(playersource,"gang") == "None" then 
        if teamName then 
            if ( money < 5000 ) then 
                outputChatBox ("#FFFFFFYou don't have enough money to create a group! [Kill more zombies]",playersource,27, 89, 224,true) 
                return 
            end 
  
            if not isGangExisting (teamName) then 
                addGang (teamName,getAccountName(getPlayerAccount(playersource))) 
                setAccountData(getPlayerAccount(playersource),"gangslots",12) 
                takePlayerMoney(playersource, 5000) 
                outputChatBox ("#FFFFFFYou successfully created your group with the name of: "..teamName..".",playersource,27, 89, 224,true)     
            else 
                outputChatBox ("#FFFFFFThere is a group with this name already!",playersource,27, 89, 224,true) 
            end 
        else 
            outputChatBox ("#FFFFFFSyntax is /creategroup !",playersource,27, 89, 224,true)   
        end 
    else 
        outputChatBox ("#FFFFFFYou are in a group already!",playersource,27, 89, 224,true) 
    end 
end 
addCommandHandler("creategroup",createGroupForPlayer) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...