stefutz101 Posted October 28, 2015 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 !
Aristates Posted October 28, 2015 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 BETTER THEN YOU MOM
stefutz101 Posted October 28, 2015 Author 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.
Aristates Posted October 28, 2015 Posted October 28, 2015 that's why I don't know BETTER THEN YOU MOM
stefutz101 Posted October 28, 2015 Author Posted October 28, 2015 Ok i will try , i will come with an answer . Thanks!
Walid Posted October 28, 2015 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. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
stefutz101 Posted October 28, 2015 Author 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 .
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