I want to implement the feature so when somebody spawns on the server he automatically writes a command in the chat. (Its for spawning a special environment for polo_drugs clientside).
Since I cant code can anyone give me a codeline in Luascript for that?
Correct! Context is that the druglabor is empty by default and each player can customize the labor with a command for example: /weed_v5 , which spawns the plants and stuff. I want to spawn this by default so the players dont have to.
Copy and pasting is not doing well, you need to learn to do things for yourself sometimes
You canât expect things to be spoonfed to you, this is just a single native function within the OnPlayerSpawned event handler.
So putting a bunch of scripts together is âdevelopingâ? Also you say if I dont know how stuff is done I should not try and learn it? My friend if everyone would be like this, we wouldnt be about to fly to mars!
If you want it to execute the command only once (on first spawn), it would look something like this:
firstSpawn = true
AddEventHandler("playerSpawned", function()
if firstSpawn == true then
ExecuteCommand("weed_v6")
firstSpawn = false
end
end)
If I remember correctly, you also have to give this resource permission to execute commands. I might be wrong on this because I havenât used the executecommand native in a while. Anyway, google is your best friend.