GamerDeMTA Posted June 7, 2013 Share Posted June 7, 2013 Hi I want to do this !!! something like this a command for do the function BUUUT For the user I say! Check1 if the command is /fuck, i must say /fuck GamerDeMTA for do the function to me! how to do that Link to comment
Castillo Posted June 7, 2013 Share Posted June 7, 2013 I really don't understand, you want to output when the player uses a command, and which commnd is that? addEventHandler ( "onPlayerCommand", root, function ( cmd ) outputChatBox ( getPlayerName ( source ) .." used the command /".. cmd ) end ) Link to comment
GamerDeMTA Posted June 7, 2013 Author Share Posted June 7, 2013 ah, imagine the command is /banh how to do that the function goes to the user? For example, with /mute it's the same. I want to do it like that. For example, /warptosanfierro .. Link to comment
Castillo Posted June 7, 2013 Share Posted June 7, 2013 addCommandHandler ( "hello", function ( thePlayer, _, who ) local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. if ( playerWho ) then -- If the player really exists... outputChatBox ( getPlayerName ( thePlayer ) .." says hello!", playerWho ) -- Output a chatbox message to him. end end ) Link to comment
GamerDeMTA Posted June 7, 2013 Author Share Posted June 7, 2013 i think u dont understand me I mean, for example, when I write /tep GamerDeMTA, GamerDeMTA gets the function for the commandhandler. For example, GamerDeMTA is warped to somewhere. If I write /tep Castillo, then Castillo goes... Understand ¿? Link to comment
Castillo Posted June 7, 2013 Share Posted June 7, 2013 I gave you an example of how to make a command to output a message to the player you fill in the command, now you must change it to do whatever you need. Link to comment
GamerDeMTA Posted June 7, 2013 Author Share Posted June 7, 2013 thanks but i changed sth. and it didnt work for me can u put a example of this? setElementPosition When I say /lv UserName it goes to the Position. [The UserName] Link to comment
GamerDeMTA Posted June 7, 2013 Author Share Posted June 7, 2013 addCommandHandler ( "warpt", function ( thePlayer, _, who ) local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. if ( playerWho ) then -- If the player really exists... setElementPosition ( playerWho, x, y, z ) end end ) Link to comment
LucasBaker Posted June 7, 2013 Share Posted June 7, 2013 \/ function teleportarPlayer (player, CMD, targetName, thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if not targetName then outputChatBox("Uso Correto: /tep nick", player) else local target = getPlayerFromName (targetName ) if not target then -- check if the name is valit outputChatBox("ERRO: Jogador não encontra-se online!", player) else local x,y,z = getElementPosition ( target ) setElementPosition ( player,x,y,z+1) --setElementPosition ( player, getElementPosition ( target )) end end end addCommandHandler ( "tep", teleportarPlayer ) Link to comment
GamerDeMTA Posted June 8, 2013 Author Share Posted June 8, 2013 \/ function teleportarPlayer (player, CMD, targetName, thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if not targetName then outputChatBox("Uso Correto: /tep nick", player) else local target = getPlayerFromName (targetName ) if not target then -- check if the name is valit outputChatBox("ERRO: Jogador não encontra-se online!", player) else local x,y,z = getElementPosition ( target ) setElementPosition ( player,x,y,z+1) --setElementPosition ( player, getElementPosition ( target )) end end end addCommandHandler ( "tep", teleportarPlayer ) will that do it? why the outputchatboxs? Link to comment
PaiN^ Posted June 8, 2013 Share Posted June 8, 2013 addCommandHandler ( "warpt", function ( thePlayer, _, who ) local playerWho = getPlayerFromName ( who ) -- Get the player from the string entered on the command. if ( playerWho ) then -- If the player really exists... setElementPosition ( playerWho, x, y, z ) end end ) Are the "x, y, z" defined smoewhere at the script ? Link to comment
manawydan Posted June 8, 2013 Share Posted June 8, 2013 try addCommandHandler ( "warpt", function ( thePlayer, _, who ) local playerWho = getPlayerFromName ( who ) if ( playerWho ) then local x, y, z = getElementPosition(playerWho) setElementPosition ( thePlayer, x, y, z ) end end ) 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