Ahmed Abo-elezz Posted December 11, 2014 Share Posted December 11, 2014 please whan i try to start script he say to me Bad argument @ 'bindKey' [Expected player at argument 1, got resource] please help me addEventHandler ("onResourceStart",getRootElement(), function () bindKey (source,"forwards","down",press) end) function press(player,key,state) if (stats == "down") then Again[player] = setTimer(function(player) local x, y, z, rx, ry, rz = getElementAttachedOffsets (Weapon) attachElements (Weapon, vehicle, x, y, z, rx, ry, rz+3) end, 50, 0, player) elseif (stats == "up") and (isTimer(Again[player])) then killTimer(Again[player]) Again[player] = nil end end Link to comment
Anubhav Posted December 11, 2014 Share Posted December 11, 2014 The message is very clear: At bindKey first argument should be player but it was a resource. See the source of onResourceStart, use getElementsByType. One more error at line 9, Weapon is not DEFINED. + off-topic: no offense but how did u create the ammunation script? seems fishy Link to comment
TAPL Posted December 11, 2014 Share Posted December 11, 2014 You should attach the event onResourceStart to resourceRoot, as getRootElement will makes the event triggered when any other resources started. Also in your code the table Again and the variables Weapon and vehicle is not defined. 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