Need help with converting a little bit of code

So i were converting some code for my and rtm516’s custom gamemode and i run into this problem sometimes its hard to convert code so dont judge please


DarkRP.notify(ply, 1, 5, "Return to the bus or be demoted in 15 seconds.")

how do i convert it properly to


notification.AddLegacy("") using ply:SendLua()

please help :slight_smile:


ply:SendLua( "notification.AddLegacy( 'Return to the bus or be demoted in 15 seconds.', 1, 5 )" )


DarkRP.notify(driver, 0, 5, "$"..CBus["TicketCost"].." added ("..ply:Nick().." joined the bus).")

Ive had problems with this too it would just create an error something like LuaCmd() and say line 1 in LuaCmd()

Can you give me an actual error with the actual code you used?

allright
heres the error
[ERROR] LuaCmd:1: ‘)’ expected near ‘must’

  1. unknown - LuaCmd:0

and the code is ply:SendLua(“notification.AddLegacy(”…failtospawnmsgprops…", “…notificationsymbolprops…”, “…notificationtimeprops…”)")

What are you trying to send there? That syntax makes no sense. Why are you Lua running it?

its from server to client


--CONFIG
failtospawnmsgprops = "You must be VIP to spawn in more props" -- error message Default: "You must be VIP to spawn in this prop"
notificationsymbolprops = 3 -- the notification symbol of the error msg http://wiki.garrysmod.com/page/Enums/NOTIFY
notificationtimeprops = 3 -- the time of the notification to popup

Sorry if i didnt understand you

thats what my mate ryan told me to put hes a dev

so i tried myself and is this right?


ply:SendLua("notification.AddLegacy('$'"..CBus["TicketCost"].."' added ('"..ply:Nick().."' joined the bus, 4, 5')")

EDIT: is it ok if i add you on steam?


ply:SendLua("notification.AddLegacy(failtospawnmsgprops, notificationsymbolprops, notificationtimeprops)")


ply:SendLua("notification.AddLegacy(CBus['TicketCost']..' added ('..ply:Nick()..' joined the bus.', 4, 5)")

thanks dude works :slight_smile:

You want it to say:


(ticketcost) added ((playername) joined the bus)

where (ticketcost) is the ticket cost and (playername) is the name of the player joining the bus, right?



local luaStr = string.format("notification.AddLegacy('%s added. (%s joined the bus)', 4, 5)", CBus["TicketCost"], ply:Nick())
ply:SendLua(luaStr)


but replace ply:Nick() with whatever you’re using to get the name of the new passenger.

EDIT:

ninja’d me