• Error when changing a player name
    8 replies, posted
I'm making an addon that change the name of the player, but after it changed the name I get an error. This is the error: [ERROR] gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:55: attempt to concatenate local 'text' (a boolean value) 1. RP_PlayerChat - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:55 2. unknown - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:143
Okay. Now what? With the Error only we cant do anything. Well, we can tell you which file and which line but thats what the error is supposed to do. Show us the Code
Do you want the whole code or just the part that change the name ?
The part that changes name (should) be fine
Here it is: net.Receive( "SetName", function( len, ply )     local name = net.ReadString()          SetMoneyOnSpawn( ply )     ply:setRPName(name, false)     ModelOnSpawn( ply ) end ) hook.Add( "PlayerSay", "OpenCharacterMenuCommand", function( ply, sentcommand )     if sentcommand == "/character" then         OpenCharacterMenu( ply )         else if ( string.StartWith( sentcommand, "/firstname" ) == true ) then                      CommandArguments={}             table.Merge( CommandArguments, (string.Split( sentcommand, " " ))  )             local steamid64 = ply:SteamID64()             local PlayerFile = "characters/"..steamid64..".txt"             local PlayerData = file.Read( PlayerFile, "DATA" )             DataTable={}             table.Merge( DataTable, (string.Split( PlayerData, "," ))  )             if DataTable[12] == "1"  and CommandArguments[2] == DataTable [3] then                 WriteToPositionInFile( ply, 3, CommandArguments[3] )                 local PlayerData = file.Read( PlayerFile, "DATA" )                 DataTable={}                 table.Merge( DataTable, (string.Split( PlayerData, "," ))  )                 ply:setRPName(DataTable[3].." "..DataTable[4], false)                 else if DataTable[12] == "2" and CommandArguments[2] == DataTable [8] then                     WriteToPositionInFile( ply, 8, CommandArguments[3] )                     local PlayerData = file.Read( PlayerFile, "DATA" )                     DataTable={}                     table.Merge( DataTable, (string.Split( PlayerData, "," ))  )                     ply:setRPName(DataTable[8].." "..DataTable[9], false)                 else                     timer.Simple( 0.1, function()                         ply:ChatPrint( "/firstname (current name) (new name) - Changes your first name" )                     end )                 end             end             else if ( string.StartWith( sentcommand, "/lastname" ) == true ) then                 CommandArguments={}                 table.Merge( CommandArguments, (string.Split( sentcommand, " " ))  )                 local steamid64 = ply:SteamID64()                 local PlayerFile = "characters/"..steamid64..".txt"                 local PlayerData = file.Read( PlayerFile, "DATA" )                 DataTable={}                 table.Merge( DataTable, (string.Split( PlayerData, "," ))  )                 if DataTable[12] == "1"  and CommandArguments[2] == DataTable [4] then                     WriteToPositionInFile( ply, 4, CommandArguments[3] )                     local PlayerData = file.Read( PlayerFile, "DATA" )                     DataTable={}                     table.Merge( DataTable, (string.Split( PlayerData, "," ))  )                     ply:setRPName(DataTable[3].." "..DataTable[4], false)                     else if DataTable[12] == "2" and CommandArguments[2] == DataTable [9] then                         WriteToPositionInFile( ply, 9, CommandArguments[3] )                         local PlayerData = file.Read( PlayerFile, "DATA" )                         DataTable={}                         table.Merge( DataTable, (string.Split( PlayerData, "," ))  )                         ply:setRPName(DataTable[8].." "..DataTable[9], false)                     else                         timer.Simple( 0.1, function()                             ply:ChatPrint( "/lastname (current name) (new name) - Changes your last name" )                         end )                     end                 end             end         end     end     return true end )
and which line exacly is like 55? since this is just a part of the whole file we dont know which file is 55
I think this is the line:     DarkRP.log(ply:Nick() .. " (" .. ply:SteamID() .. "): " .. text)
It's because you return true instead of a string. You're supposed to either return nothing or a string in a PlayerSay hook.
Thanks, for the tip ^^ btw your tool is very useful.
Sorry, you need to Log In to post a reply to this thread.