ville Posted March 5, 2015 Share Posted March 5, 2015 Hi, i want to modify this script so polices can give tickets to criminals, i added that wanted line .. but its not working. I want to know what im doing wrong function mandat(player, cmd, who, ile) local who = getPlayerFromName(who) if getPlayerTeam(player) == getTeamFromName("Police") then takePlayerMoney(who, tonumber(ile)) outputChatBox("Player "..getPlayerName(who).." has been given ticket ("..tonumber(ile).."$)") end end addCommandHandler("ticket", mandat) Link to comment
MisterQuestions Posted March 5, 2015 Share Posted March 5, 2015 Debugscript 3?? I think would be more easy use a variable for getPlayerTeam, then a variable for getTeamName If teamName == "desired" then Edit: I changed this code like this..try now. function mandat(player, cmd, who, amount) local who = getPlayerFromName(who) local team = getPlayerTeam(player) if team then local name = getTeamName(team) if name == "Police" then local money = takePlayerMoney(who, tonumber(amount)) if money then outputChatBox("Player "..getPlayerName(who).." has been given ticket ("..tonumber(ile).."$)") else outputDebugString("Something fails!") end end end end addCommandHandler("ticket", mandat) Link to comment
Enargy, Posted March 6, 2015 Share Posted March 6, 2015 EDIT: takePlayerMoney it works to take the amount of money which player has. use givePlayerMoney instead of takePlayerMoney. 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