Xeno Posted February 1, 2012 Share 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. Link to comment
Castillo Posted February 1, 2012 Share 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. Link to comment
Xeno Posted February 1, 2012 Author Share 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^ Link to comment
JR10 Posted February 1, 2012 Share Posted February 1, 2012 What do you need to know about it, getPlayerFromPartialName? Link to comment
Castillo Posted February 1, 2012 Share 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? Link to comment
Xeno Posted February 1, 2012 Author Share 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.. Link to comment
Castillo Posted February 1, 2012 Share 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) Link to comment
Xeno Posted February 1, 2012 Author Share 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? Link to comment
Castillo Posted February 1, 2012 Share 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) Link to comment
Xeno Posted February 1, 2012 Author Share Posted February 1, 2012 It says I don't exist when I type in the command. Link to comment
Klesh Posted February 1, 2012 Share 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 Link to comment
JR10 Posted February 1, 2012 Share Posted February 1, 2012 Are you sure you typed in the whole name correct? 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