• Usermessages
    7 replies, posted
[lua] umsg.Start("select_char_alert",ply) umsg.End() [/lua] Why is this sent to everyone not just the player(ply), and ply is defined. See post [url=http://www.facepunch.com/threads/1040693-Usermessages?p=26890379&viewfull=1#post26890379]number seven[/url].
ply is nil. It could also be a problem that the usermessage itself is empty, I had weird results with empty usermessages a while ago.
I think that var is supposed to be a RecipientFilter. [url]http://wiki.garrysmod.com/?title=User_Messages[/url]
[QUOTE=Lord Ned;26870092]I think that var is supposed to be a RecipientFilter. [url]http://wiki.garrysmod.com/?title=User_Messages[/url][/QUOTE] Doesn't matter, if you read more carefully you would have figured that you can either pass a player entity OR a recipient filter.
Can we see what function this code is being called from?
Yeah. Function? And the function where you receive it at client.
[lua] function CharacterModel(name) if not name then return '' end print(name) -- Queries ran here and defined rtq1 & rtq2 local model = "models/player/group_01/"..rtq2.."_0"..rtq2..".mdl" return model end function GetAllCharacters(ply) local steamid = ply:SteamID() local ammt = PlayerCharacters(steamid) for i=1,ammt do // Queries were here and defined name2, lives2 local pmodel = CharacterModel(name2) print(pmodel) print(name2, lives2, cdate2) umsg.Start("erp_charactermenu", ply) umsg.String(tostring(name2)) umsg.String(tostring(lives2)) umsg.String(tostring(cdate2)) umsg.String(tostring(pmodel)) umsg.End()end end concommand.Add("erp_getcharacters",GetAllCharacters) [/lua] [editline]23rd December 2010[/editline] Also when this is ran, this is printed into console.log [code] zack [gamemodes\exolocityrp\gamemode\mysql\mysql_characters.lua:7] attempt to call local 'name' (a string value) [/code] "zack" is the players name responding to line 3 of the CharacterModel function. This is line seven of original code. [lua] local query = "SELECT modelnum FROM characters WHERE name = '"..name"'" [/lua]
You forgot to add .. between name and "'".
Sorry, you need to Log In to post a reply to this thread.