stefutz101 Posted October 28, 2015 Share Posted October 28, 2015 Hi i want to make a system what give you guns at spawn on a dayz server . First time i try with : addEventHandler("onPlayerSpawn",root, function () setElementData(source,"GPS",1) outputChatBox("ok",source,255,0,0) end) After that i realized : at spawn spawn.lua set you items on 0. So i think I need a delay to give that guns , so i try addEventHandler("onPlayerSpawn",root, function () setTimer ( function() setElementData(source,"GPS",1) end, 5000, 1 ) outputChatBox("ok",source,255,0,0) end) No errors or warnings , thanks in advance ! Link to comment
Aristates Posted October 28, 2015 Share Posted October 28, 2015 Hm... you Use TriggerClientEvent. addEventHandler("onPlayerSpawn",root, function () setTimer ( function() setElementData(source,"GPS",1) end, 5000, 1 ) outputChatBox("ok",source,255,0,0) triggerClientEvent( client, "Triggers", client) end) --#Client addEvent("Triggers", true) addEventHandler("Triggers", root, function(player) givePedWeapon(player, 31, 5000, true) end Link to comment
stefutz101 Posted October 28, 2015 Author Share Posted October 28, 2015 If i change : givePedWeapon(player, 31, 5000, true) with : setElementData(source,"GPS",1) Works ? Because gamemode is dayz and if i use that function weapon dont appear in invetory. Link to comment
Aristates Posted October 28, 2015 Share Posted October 28, 2015 that's why I don't know Link to comment
stefutz101 Posted October 28, 2015 Author Share Posted October 28, 2015 Ok i will try , i will come with an answer . Thanks! Link to comment
Walid Posted October 28, 2015 Share Posted October 28, 2015 Ok i will try , i will come with an answer . Thanks! Don't follow him he already gave you a bad example. you need to replace client with source . the source of this event onPlayerSpawn is the player that just spawned. Link to comment
stefutz101 Posted October 28, 2015 Author Share Posted October 28, 2015 It works , but it works only first time . After the secound spawn i don't have any items . But if I restart resource and type /kill it work , but only at first kill . triggerClientEvent( client, "Triggers", client) Yes , i change "client" with "source" and it works , but only first time . 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