Jump to content

Admin PM Script


xXGhostXx

Recommended Posts

Hi guys .

What is problem in my script ?

function adminpm ( thePlayer, command, taraf, message )
  if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
    
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

How to fix text can not be sent more than one word.

Please answer me.

Link to comment
function adminpm ( thePlayer, command, taraf,... )
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
    
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

try that

Link to comment
10 hours ago, Dimos7 said:

function adminpm ( thePlayer, command, taraf,... )
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
    
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

try that

When i use /pm <PartOfName>
An empty message will be sent.

please fix my script :(

Link to comment

Then:
 

function adminpm ( thePlayer, command, taraf,... )
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if( message == nil or message == "" ) then
    outputChatBox("#ff0000[Error]: #ffffffWrite a message!", thePlayer, 255, 255, 255, true)
    return false
  end
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

 

Link to comment
6 minutes ago, iMr.WiFi..! said:

Then:
 


function adminpm ( thePlayer, command, taraf,... )
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if( message == nil or message == "" ) then
    outputChatBox("#ff0000[Error]: #ffffffWrite a message!", thePlayer, 255, 255, 255, true)
    return false
  end
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

 

Not work !

Link to comment

Try this: 
 

function adminpm ( thePlayer, command, taraf,... )
  
  if( #{...} == 0 ) then
    outputChatBox("#ff0000[Error]: #ffffffWrite a message!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

 

Edited by iMr.WiFi..!
  • Like 1
Link to comment
4 minutes ago, iMr.WiFi..! said:

Try this: 
 


function adminpm ( thePlayer, command, taraf,... )
  
  if( #{...} == 0 ) then
    outputChatBox("#ff0000[Error]: #ffffffWrite a message!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

 

Not work :(

Debug error:

server.lua:3: unexpected symbol near '

Link to comment
1 hour ago, iMr.WiFi..! said:

Try this: 
 


function adminpm ( thePlayer, command, taraf,... )
  
  if( #{...} == 0 ) then
    outputChatBox("#ff0000[Error]: #ffffffWrite a message!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local message = table.concat ({...}, " ") 
 if not ( isPlayerOnGroup ( thePlayer ) ) then
    outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  if taraf == nil then
    outputChatBox("#00ff00Bezan: /pm <PartOfName> <Matn>", thePlayer, 255, 255, 255, true)
      return false
    end
    
  if not findPlayer(taraf) then
    outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
    return false
  end
  
  local playerpm = findPlayer(taraf)
  local nameadmin = getPlayerName( thePlayer )
  outputChatBox("#F39C12<< Be " ..taraf.. ": " ..message.. " >>", thePlayer, 255, 255, 255, true)
  outputChatBox("#F39C12<< [Admin PM] " ..nameadmin.. ": " ..message.. " >>", playerpm, 255, 255, 255, true)

end
addCommandHandler("pm", adminpm)

 

Thanks .

Fixed ❤️

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...