[DMC] Posted October 1, 2010 Share Posted October 1, 2010 (edited) function checkMoney(thePlayer, command, who) if (who == nil ) or who == false then outputChatBox ("ERROR: You must insert a valid player name.", thePlayer, 255, 0, 0, false) else local money = getPlayerMoney(targetPlayerName) local Name = getPlayerName(targetPlayerName) local targetPlayerName = getPlayerFromName (who) outputChatBox("*"..who.." Has $"..getPlayerMoney(who).."",getRootElement(),255,255,0) end addCommandHandler("cash", checkMoney) And yes varez i first thought about it cuz first i had getPlayerMoney(thePlayer) and i know thats just wrong Please any help its saying local money/name has bad arguments Edited October 1, 2010 by Guest Link to comment
Castillo Posted October 1, 2010 Share Posted October 1, 2010 function checkMoney2(thePlayer, command, who) if (who == nil ) or who == false then outputChatBox ("ERROR: You must insert a valid player name.", thePlayer, 255, 0, 0, false) else local who2 = getPlayerFromName(who) local Name = getPlayerName(who2) outputChatBox("*"..who.." Has $"..getPlayerMoney(who2).."",getRootElement(),255,255,0) end end addCommandHandler("cash", checkMoney2) you forgot to do getPlayerFromName Link to comment
[DMC] Posted October 1, 2010 Author Share Posted October 1, 2010 ty but can someoen tell me how i do /cash part of name and not type whole name Link to comment
dzek (varez) Posted October 1, 2010 Share Posted October 1, 2010 [DMC] i suggest you to think while scripting, you are still doing "random coding". and answer to your 2nd post in this topic is here Link to comment
Vercetti1010 Posted October 5, 2010 Share Posted October 5, 2010 Looks like it is just layed out backwards there almost. Try something like this (Sorry if there are any errors, the wiki is down and i can't make 100% sure i put the exact right function) function findPlayerMoney(player,command,player2) if (player2) then local name = getPlayerFromName(player2) if (name) then local playerMoney = getPlayerMoney(name) outputChatBox(player2.." has $"..tostring(playerMoney),player,255,255,0) else outputChatBox("No player found for "..player2,player,255,0,0) end else outputChatBox("Player not specified. The proper command goes like: /cash player",player,255,0,0) end end addCommandHandler("cash",findPlayerMoney) If you find the nickname autocomplete function, it makes this script a lot better too, since you don't have to type out people's whole names when looking them up in a command. I can't remember that off the top of my head, so this will do for now. Good luck with your scripting! 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