Blaawee Posted January 14, 2012 Share Posted January 14, 2012 hello guys , i'm trying to change my name to arabic name in the chat this is what i'v been do : function changename( thePlayer, command, name ) if ( name ) then local newPlayerNick = " .. name .. " local oldNick = getElementData( thePlayer, "ar.name" ) if ( oldNick == false ) then setElementData ( thePlayer, "ar.name", newPlayerNick ) outputChatBox ("Your new nickname has been set to" .. getElementData( thePlayer, "ar.name", newPlayerNick ), thePlayer,0,255,0,true ) else outputChatBox ("Incorrect syntax, Correct: /name ", thePlayer,255,0,0,true ) end end end addCommandHandler( "name", changename ) function chat( msg, type ) if type == 0 and getElementData( thePlayer, "ar.name", newPlayerNick ) ~= false then cancelEvent() outputChatBox("[ " .. newPlayerNick .. " ] : " .. msg, getRootElement(), 255, 255, 255, true) end end addEventHandler("onPlayerChat", root, chat ) is there any way to make it Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 function changename( thePlayer, command, name ) if ( not name ) then outputChatBox ("Incorrect syntax, Correct: /name ", thePlayer,255,0,0,true ) return end local newPlayerNick = name local oldNick = getElementData( thePlayer, "ar.name" ) if ( oldNick == false ) then setElementData ( thePlayer, "ar.name", newPlayerNick ) outputChatBox ("Your new nickname has been set to: ".. newPlayerNick, thePlayer,0,255,0,true ) end end addCommandHandler( "name", changename ) function chat( msg, type ) if (type == 0 and getElementData( source, "ar.name" ) ~= false) then cancelEvent() outputChatBox("[ " .. tostring(getElementData( source, "ar.name" )) .. " ] : " .. msg, getRootElement(), 255, 255, 255, true) end end addEventHandler("onPlayerChat", root, chat ) Link to comment
Blaawee Posted January 14, 2012 Author Share Posted January 14, 2012 that's to fast solidsnake but when i type this command : /name بلاوي it say's : Incorrect syntax, Correct: /name and my name will be like this : [.. name ..] : hi i want convert it to arabic name Link to comment
Blaawee Posted January 14, 2012 Author Share Posted January 14, 2012 it's work fine but i can't change my name again Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 That's because you added a check to see if he already has a name. function changename( thePlayer, command, name ) if ( not name ) then outputChatBox ("Incorrect syntax, Correct: /name ", thePlayer,255,0,0,true ) return end local newPlayerNick = name setElementData ( thePlayer, "ar.name", newPlayerNick ) outputChatBox ("Your new nickname has been set to: ".. newPlayerNick, thePlayer,0,255,0,true ) end addCommandHandler( "name", changename ) function chat( msg, type ) if (type == 0 and getElementData( source, "ar.name" ) ~= false) then cancelEvent() outputChatBox("[ " .. tostring(getElementData( source, "ar.name" )) .. " ] : " .. msg, getRootElement(), 255, 255, 255, true) end end addEventHandler("onPlayerChat", root, chat ) Link to comment
Blaawee Posted January 14, 2012 Author Share Posted January 14, 2012 thx solid that great work thx allot 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