matttu Posted December 10, 2014 Share Posted December 10, 2014 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
Castillo Posted December 10, 2014 Share Posted December 10, 2014 getPlayerMoney takePlayerMoney Link to comment
matttu Posted December 10, 2014 Author Share Posted December 10, 2014 Tried alot, but nothing, I hate to say this, but i need more instructions. Link to comment
Castillo Posted December 10, 2014 Share Posted December 10, 2014 Post what you have tried. Link to comment
matttu Posted December 10, 2014 Author Share Posted December 10, 2014 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
Castillo Posted December 10, 2014 Share Posted December 10, 2014 And how did it "break"? btw, you have to put takePlayerMoney after you make the gang, else there might be a group with that name, and the player loses the money anyway. Link to comment
DiSaMe Posted December 10, 2014 Share Posted December 10, 2014 takePlayerMoney needs player as the first argument. And = is assignment operator. Use == to check if values are equal to each other (though there's no need to check for equality in this case). Link to comment
matttu Posted December 11, 2014 Author Share Posted December 11, 2014 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
Castillo Posted December 13, 2014 Share Posted December 13, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now