• Help with Basic GLua
    6 replies, posted
Hi there, I'm currently learning to code lua, but I'm slightly stuck on how to get the GM:PropBreak to detect the prop broken. Here is my code: local function PropBreak( client, prop ) chat.AddText(client, " just broke the prop ",..prop:GetClass()..) end This code works, but it just doesn't get the prop type, which is really annoying, I'd appreciate any help I can get, thanks!
Are you calling this function in the PropBreak hook?
Try removing the two dots before and after prop:GetClass() [editline]24th July 2016[/editline] Those dots usually mean you're trying to join a string, but since you're separating everything with a comma the dots might be stuffing it up
[QUOTE=MPan1;50764542]Try removing the two dots before and after prop:GetClass() [editline]24th July 2016[/editline] Those dots usually mean you're trying to join a string, but since you're separating everything with a comma the dots might be stuffing it up[/QUOTE] I actually had the code without any dots before-hand, but it didn't work, so I added them with wishful thinking! In reply to the first comment, I did originally use hook.Add, but it didn't make any difference because it resulted exactly the same: [IMG]http://puu.sh/qcfjV/68653482f5.jpg[/IMG]
Try printing the prop
So, I tried that, but nothing outputted, but then I saw it.. whenever I spawn the prop and break it, a really small brown text appears at the top of the screen that say the model name, and I have no idea why XD [IMG]http://puu.sh/qcg5u/e446f9e587.jpg[/IMG] Update: I don't know if my program is broken or my game is, but it's literally whenever I spawn any prop that this happens... so strange..
Well, if nothing outputs when you print the prop, then prop:GetClass() won't work since the prop doesn't exist, and you can't get the class of a nonexistant prop- odd that it doesn't work for you though
Sorry, you need to Log In to post a reply to this thread.