Dking2001 Posted June 14, 2017 Share Posted June 14, 2017 hi guys i have a problem to set ped rotation like player rotation always i mean if you change yor rotation the ped change his rotation too sorry for bad English here is the code local pylonid = 2662 local pylon_x, pylon_y = 0, 0.5 local pylon_c, pylon_v = 0, 0 local pylonheight = 0 local pylonscale = 1.3 local function pylonHead(player, command) if not pylon or pylon == nil then local px, py, pz = getElementPosition( player ) pylon = createObject( pylonid, px, py, pz) attachElements(pylon, player, pylon_x-1, pylon_y, pylonheight, 0, 0, 180) setObjectScale( pylon, pylonscale ) setElementCollisionsEnabled( pylon, true ) myBlip = createBlipAttachedTo ( player, 19 ) ped = createPed( 105, px, py, pz) attachElements( ped, player, pylon_c-2, pylon_v, pylonheight) setPedAnimation(ped, "wuzi", "wuzi_walk") peda = createPed( 33, px, py, pz) attachElements( peda, player, pylon_c-1, pylon_v-1, pylonheight) setPedAnimation(peda, "wuzi", "wuzi_walk") pedb = createPed( 33, px, py, pz) attachElements( pedb, player, pylon_c, pylon_v-1, pylonheight) setPedAnimation(pedb, "wuzi", "wuzi_walk") pedc = createPed( 105, px, py, pz) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk") else detachElements( pylon, player ) detachElements( ped, player ) detachElements( peda, player ) detachElements( pedb, player ) detachElements( pedc, player ) destroyElement( pylon ) setPedAnimation(ped, "riot", "riot_angry") setPedAnimation(peda, "riot", "riot_chant") setPedAnimation(pedb, "riot", "riot_punches") setPedAnimation(pedc, "riot", "riot_shout") destroyElement( myBlip ) pylon = nil end end addCommandHandler("bnr", pylonHead) i want the peds (ped , peda , pedb and pedc) moveing with me i need only to set rotation changing with me thank you ... mta server write like this [00:53:36] WARNING: banner\pylonhead.lua:28: Bad argument @ 'setElementRotation' [Expected element at argument 1, got number '0'] Link to comment
Mhmd.z Posted June 15, 2017 Share Posted June 15, 2017 local pylonid = 2662 local pylon_x, pylon_y = 0, 0.5 local pylon_c, pylon_v = 0, 0 local pylonheight = 0 local pylonscale = 1.3 local function pylonHead(player, command) if not pylon or pylon == nil then local px, py, pz = getElementPosition( player ) pylon = createObject( pylonid, px, py, pz) attachElements(pylon, player, pylon_x-1, pylon_y, pylonheight, 0, 0, 180) setObjectScale( pylon, pylonscale ) setElementCollisionsEnabled( pylon, true ) myBlip = createBlipAttachedTo ( player, 19 ) ped = createPed( 105, px, py, pz) setTimer(setPedRotation, 50, 0, ped, getPlayerRotation(player)) attachElements( ped, player, pylon_c-2, pylon_v, pylonheight) setPedAnimation(ped, "wuzi", "wuzi_walk") peda = createPed( 33, px, py, pz) setTimer(setPedRotation, 50, 0, peda, getPlayerRotation(player)) attachElements( peda, player, pylon_c-1, pylon_v-1, pylonheight) setPedAnimation(peda, "wuzi", "wuzi_walk") pedb = createPed( 33, px, py, pz) setTimer(setPedRotation, 50, 0, pedb, getPlayerRotation(player)) attachElements( pedb, player, pylon_c, pylon_v-1, pylonheight) setPedAnimation(pedb, "wuzi", "wuzi_walk") pedc = createPed( 105, px, py, pz) setTimer(setPedRotation, 50, 0, pedc, getPlayerRotation(player)) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk") else detachElements( pylon, player ) detachElements( ped, player ) detachElements( peda, player ) detachElements( pedb, player ) detachElements( pedc, player ) destroyElement( pylon ) setPedAnimation(ped, "riot", "riot_angry") setPedAnimation(peda, "riot", "riot_chant") setPedAnimation(pedb, "riot", "riot_punches") setPedAnimation(pedc, "riot", "riot_shout") destroyElement( myBlip ) pylon = nil end end addCommandHandler("bnr", pylonHead) Link to comment
Dking2001 Posted June 15, 2017 Author Share Posted June 15, 2017 8 hours ago, Mhmd.z said: local pylonid = 2662 local pylon_x, pylon_y = 0, 0.5 local pylon_c, pylon_v = 0, 0 local pylonheight = 0 local pylonscale = 1.3 local function pylonHead(player, command) if not pylon or pylon == nil then local px, py, pz = getElementPosition( player ) pylon = createObject( pylonid, px, py, pz) attachElements(pylon, player, pylon_x-1, pylon_y, pylonheight, 0, 0, 180) setObjectScale( pylon, pylonscale ) setElementCollisionsEnabled( pylon, true ) myBlip = createBlipAttachedTo ( player, 19 ) ped = createPed( 105, px, py, pz) setTimer(setPedRotation, 50, 0, ped, getPlayerRotation(player)) attachElements( ped, player, pylon_c-2, pylon_v, pylonheight) setPedAnimation(ped, "wuzi", "wuzi_walk") peda = createPed( 33, px, py, pz) setTimer(setPedRotation, 50, 0, peda, getPlayerRotation(player)) attachElements( peda, player, pylon_c-1, pylon_v-1, pylonheight) setPedAnimation(peda, "wuzi", "wuzi_walk") pedb = createPed( 33, px, py, pz) setTimer(setPedRotation, 50, 0, pedb, getPlayerRotation(player)) attachElements( pedb, player, pylon_c, pylon_v-1, pylonheight) setPedAnimation(pedb, "wuzi", "wuzi_walk") pedc = createPed( 105, px, py, pz) setTimer(setPedRotation, 50, 0, pedc, getPlayerRotation(player)) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk") else detachElements( pylon, player ) detachElements( ped, player ) detachElements( peda, player ) detachElements( pedb, player ) detachElements( pedc, player ) destroyElement( pylon ) setPedAnimation(ped, "riot", "riot_angry") setPedAnimation(peda, "riot", "riot_chant") setPedAnimation(pedb, "riot", "riot_punches") setPedAnimation(pedc, "riot", "riot_shout") destroyElement( myBlip ) pylon = nil end end addCommandHandler("bnr", pylonHead) its not working ... mta server write like this [16:06:25] WARNING: banner\pylonhead.lua:17: Bad argument @ 'setPedRotation' [Expected element at argument 1] [DUP x101] [16:06:25] WARNING: banner\pylonhead.lua:21: Bad argument @ 'setPedRotation' [Expected element at argument 1] [DUP x101] [16:06:25] WARNING: banner\pylonhead.lua:25: Bad argument @ 'setPedRotation' [Expected element at argument 1] [DUP x101] [16:06:25] WARNING: banner\pylonhead.lua:29: Bad argument @ 'setPedRotation' [Expected element at argument 1] [DUP x101] but i dont know why its working for one time only Link to comment
Mhmd.z Posted June 15, 2017 Share Posted June 15, 2017 local pylonid = 2662 local pylon_x, pylon_y = 0, 0.5 local pylon_c, pylon_v = 0, 0 local pylonheight = 0 local pylonscale = 1.3 local function pylonHead(player, command) if not pylon or pylon == nil then local px, py, pz = getElementPosition( player ) pylon = createObject( pylonid, px, py, pz) attachElements(pylon, player, pylon_x-1, pylon_y, pylonheight, 0, 0, 180) setObjectScale( pylon, pylonscale ) setElementCollisionsEnabled( pylon, true ) myBlip = createBlipAttachedTo ( player, 19 ) ped = createPed( 105, px, py, pz) setTimer(setPedRotation, 50, 0, ped, getPedRotation(player)) attachElements( ped, player, pylon_c-2, pylon_v, pylonheight) peda = createPed( 33, px, py, pz) attachElements( peda, player, pylon_c-1, pylon_v-1, pylonheight) setPedAnimation(peda, "wuzi", "wuzi_walk") pedb = createPed( 33, px, py, pz) attachElements( pedb, player, pylon_c, pylon_v-1, pylonheight) setPedAnimation(pedb, "wuzi", "wuzi_walk") pedc = createPed( 105, px, py, pz) attachElements( pedc, player, pylon_c-2, pylon_v-1, pylonheight) setPedAnimation(pedc, "wuzi", "wuzi_walk") setTimer(function() local rotation = getPedRotation(player) setPedRotation(ped, rotation) setPedRotation(peda, rotation) setPedRotation(pedb, rotation) setPedRotation(pedc, rotation) end, 50, 0) else detachElements( pylon, player ) detachElements( ped, player ) detachElements( peda, player ) detachElements( pedb, player ) detachElements( pedc, player ) destroyElement( pylon ) setPedAnimation(ped, "riot", "riot_angry") setPedAnimation(peda, "riot", "riot_chant") setPedAnimation(pedb, "riot", "riot_punches") setPedAnimation(pedc, "riot", "riot_shout") destroyElement( myBlip ) pylon = nil end end addCommandHandler("bnr", pylonHead) 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