-Note Posted April 17, 2020 Share Posted April 17, 2020 Is it possible to get the player name who restart/start/stop a specific resource? Cuz I'm using this to catch player name but It returns me some error which is "getPlayerName expected player, got nil" but I already added a player. Sorry if I have done something wrong and this is my first time in Lua. addEventHandler("onResourceStart",root, function (resource, thePlayer) if getResourceInfo(resource,"type") ~= "map" then outputChatBox(getResourceName(resource).." started by "..getPlayerName(thePlayer)) end end ) Link to comment
Moderators Patrick Posted April 17, 2020 Moderators Share Posted April 17, 2020 (edited) Hi! Sadly you can't catch player's element like that. thePlayer is not a "magic" variable, event's argument list is predetermined, you can find it on wiki. Here you can see, this event is pass only one variable, at first place. Quote Parameters resource startedResource startedResource: the resource that was started. You need to do an own restart function/command, with: addCommandHandler and restartResource And print your own notification when someone use this command. Edited April 17, 2020 by Patrick 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