Jump to content

Help with commands


Zekrom=

Recommended Posts

I am a new in the scripter's world, Im doing a commands script for race, i make a command called /ltd, ''Learn to drive'', but i want to write /ltd (a player name) and in the chat see ''Zekrom Says Learn to drive ( player name)!''

addCommandHandler("ltd", 
function (thePlayer) 
outputChatBox(getPlayerName(thePlayer).." #0099ffSays #ffffffLearn To #0099ffDrive!!",getRootElement(), 255, 255, 255, true ) 
end) 

Help please :D

Link to comment

try this (not tested)

addCommandHandler("ltd", 
function (thePlayer, cmd, tarPlayer) 
outputChatBox(getPlayerName(thePlayer).." #0099ffSays #ffffffLearn To #0099ffDrive "..tarPlayer.." !!",root, 255, 255, 255, true ) 
end) 

Link to comment

Yeah!, it work ! Thank you !!

I found something, if i write /ltd (any word) in the chat says : Zekrom Says learn to Drive (the word)!, Is there any way to do that just to put the names of the players?, And if the player is not there say in the chat: Player not found?

Again, Thank You !

Edited by Guest
Link to comment
addCommandHandler("ltd", 
function (thePlayer, cmd, tarPlayer) 
local name = getPlayerFromName ( tarPlayer ) 
       if name then 
    outputChatBox(getPlayerName(thePlayer).." #0099ffSays #ffffffLearn To #0099ffDrive "..getPlayerName(name).." !!",root, 255, 255, 255, true ) 
       else 
    outputChatBox("Player not found",thePlayer, 255, 255, 255, true ) 
       end 
end) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...