• Getting variables from entities
    4 replies, posted
Is there a way for the gamemode init.lua to check a variable that is being changed in the init.lua of an entity? For example, an entity sensing a player nearby, and sending that entity to the gamemode init.lua Thank you, Endus322
Can you be very specific about what you want? Your problem is too general
[QUOTE=code_gs;52412890]Can you be very specific about what you want? Your problem is too general[/QUOTE] If I have an entity that has a variable, lets say, "Player." Is there a way for the gamemode files to use that variable in an if statement? like this Entity files: [CODE]Player = "Endus322"[/CODE] Gamemode files: [CODE]if(Player == "Endus322") then -- do something end[/CODE] I hope that clears it up
ENTITY.Player = "Endus322" Though you should use SteamID, or straight up assign the player entity, depends what you need. Also, if you need it on the client as well: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetNWString]Entity:SetNWString[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetNWEntity]Entity:SetNWEntity[/url] What is the reason for this need? Perhaps the whole thing can be solved more simply
[QUOTE=JasonMan34;52415100]ENTITY.Player = "Endus322" Though you should use SteamID, or straight up assign the player entity, depends what you need. Also, if you need it on the client as well: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetNWString]Entity:SetNWString[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SetNWEntity]Entity:SetNWEntity[/url] What is the reason for this need? Perhaps the whole thing can be solved more simply[/QUOTE] There probably could be better ways, but I just wanted to know if it was possible for the future, seeing as it might be a problem I would run into.
Sorry, you need to Log In to post a reply to this thread.