[url]https://www.youtube.com/watch?v=rQWclUb_aNg[/url]
i made a video showing my code and explaining the problem.
is there any better way to do what im trying to do? or can some one tell me how to make this work
Alright; so you've got ENT:Use to send a net-message to the client to open a window; next send a message to the server ( or to the original npc ) and have the server determine delivery point from a table, or whatever.
If multiple people can use the npc I'd suggest setting up a list in one of several ways depending on how things can be done. If one player can take multiple deliveries out or just one the best way would be to use SteamID as a key to the deliveries table. The value could be a table consisting of the delivery point, the originating npc, or whatever. When you press e on a delivery point you should have direct access to the table ( since it should be done on the server ) and the npc would be able to directly access the value stored at the steamid key.
Now, depending on if you allow one to many, you can read the value itself, or you'd set up the steamid as key, the value being a table then use table.insert to add deliveries. Traditionally you'd allow 1 max so steamid key = data...
You've already got most of it done except sending the message back to server to set up the deliveries table.
I have one example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_zipped_code/acecool_npc_jointeam_example.rar[/url]
Instead of SetTeam you'd use a global deliveries table to check if the player already has a delivery then either accept / deny. The receiving npc should simply set the value to nil if you only allow 1, or you allow many and the last one has been delivered.
[QUOTE=Acecool;47096538]Alright; so you've got ENT:Use to send a net-message to the client to open a window; next send a message to the server ( or to the original npc ) and have the server determine delivery point from a table, or whatever.
If multiple people can use the npc I'd suggest setting up a list in one of several ways depending on how things can be done. If one player can take multiple deliveries out or just one the best way would be to use SteamID as a key to the deliveries table. The value could be a table consisting of the delivery point, the originating npc, or whatever. When you press e on a delivery point you should have direct access to the table ( since it should be done on the server ) and the npc would be able to directly access the value stored at the steamid key.
Now, depending on if you allow one to many, you can read the value itself, or you'd set up the steamid as key, the value being a table then use table.insert to add deliveries. Traditionally you'd allow 1 max so steamid key = data...
You've already got most of it done except sending the message back to server to set up the deliveries table.
I have one example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_zipped_code/acecool_npc_jointeam_example.rar[/url]
Instead of SetTeam you'd use a global deliveries table to check if the player already has a delivery then either accept / deny. The receiving npc should simply set the value to nil if you only allow 1, or you allow many and the last one has been delivered.[/QUOTE]
wow thanks. thats exactly what i was thinking of. now i know how to do it
Sorry, you need to Log In to post a reply to this thread.