Xeno Posted February 1, 2012 Posted February 1, 2012 Ok, I don't really know whats it called, but I know it has a specific name... I want to know how to do one of them /setmoney [name] [cash] -- But I have no clue how, could you give me some way to do this? Thanks, Xeno.
Castillo Posted February 1, 2012 Posted February 1, 2012 I don't understand what do you mean, you want to restrict commands using ACL? or for only some players? like checking their serials.
Xeno Posted February 1, 2012 Author Posted February 1, 2012 Sorry, I'm rubbish at explaining: I mean like one of these, for example, /jail [playername] I need to know how to make one of these^
JR10 Posted February 1, 2012 Posted February 1, 2012 What do you need to know about it, getPlayerFromPartialName?
Castillo Posted February 1, 2012 Posted February 1, 2012 function sayHello(thePlayer, cmd, who) if (who and who ~= "") then local player = getPlayerFromName(who) if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end outputChatBox("Hello ".. getPlayerName(player) .. " from ".. getPlayerName(thePlayer) .."!",player,0,255,0) end end addCommandHandler("hello",sayHello) That?
Xeno Posted February 1, 2012 Author Posted February 1, 2012 function sayHello(thePlayer, cmd, who) if (who and who ~= "") then local player = getPlayerFromName(who) if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end outputChatBox("Hello ".. getPlayerName(player) .. " from ".. getPlayerName(thePlayer) .."!",player,0,255,0) end end addCommandHandler("hello",sayHello) That? Yes, that is exactly what I need... But I need to setElementData with it, so I can do something like /setrank Awesome I gave it ago...: function sayHello(thePlayer, cmd, who) if (who and who ~= "") then local player = getPlayerFromName(who) if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end setElementData(player,"Rank","Awesome") end end addCommandHandler("setRank",sayHello) But I guess this wouldn't work..
Castillo Posted February 1, 2012 Posted February 1, 2012 function setRank(thePlayer, cmd, who) if (who and who ~= "") then local player = getPlayerFromName(who) if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end setElementData(player,"Rank","Awesome") end end addCommandHandler("setRank",setRank)
Xeno Posted February 1, 2012 Author Posted February 1, 2012 Thats awesome. Would there be a way to do something like /setRank [name] [rank] ? Or is that not possible at all?
Castillo Posted February 1, 2012 Posted February 1, 2012 Of course it's possible. function setRank(thePlayer, cmd, who, ...) if (who and who ~= "") then local player = getPlayerFromName(who) local rank = table.concat({...}, " ") if (not player) then outputChatBox("This player does not exists.",thePlayer,255,0,0) return end setElementData(player,"Rank",tostring(rank)) end end addCommandHandler("setRank",setRank)
Xeno Posted February 1, 2012 Author Posted February 1, 2012 It says I don't exist when I type in the command.
Klesh Posted February 1, 2012 Posted February 1, 2012 You can use my resource from the comunity, it have getPlayerFromPartOfName as exported function: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3629
JR10 Posted February 1, 2012 Posted February 1, 2012 Are you sure you typed in the whole name correct?
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