EvilB12 Posted July 9, 2014 Share Posted July 9, 2014 I have been trying to give weapon to a ped which i have created in a client sided script but its not working. Server sided:- addEvent ( "giveWeaponS", true ) addEventHandler("giveWeaponS", getRootElement (), function ( ped, wID, ammo ) giveWeapon ( ped, tonumber ( wID ), tonumber ( ammo ), true ) outputChatBox("trigger") end ) Client sided:- addCommandHandler("ped",function () ped = createPed ( 100, 2707.11621, 2219.65137, 6.74981 ) triggerServerEvent ( "giveWeaponS", getLocalPlayer(), ped, 27, 500) end ) Link to comment
Max+ Posted July 9, 2014 Share Posted July 9, 2014 will , i had the same problem of yours , i couldn't fix it, i hope someone come and fix it , we can both understand it, Link to comment
EvilB12 Posted July 9, 2014 Author Share Posted July 9, 2014 Looking forward for someone to help :[ Link to comment
#DRAGON!FIRE Posted July 9, 2014 Share Posted July 9, 2014 (edited) * Server Side addCommandHandler( "ped", function ( ) if ( isElement( ped ) ) then destroyElement( ped ) end ped = createPed ( 100, 2707.11621, 2219.65137, 6.74981 ) if ( ped ) then giveWeapon ( ped, 27, 500, true ) end end ) Edited July 9, 2014 by Guest Link to comment
iPrestege Posted July 9, 2014 Share Posted July 9, 2014 You can't give a 'PED' Weapon which created from the client side. Link to comment
EvilB12 Posted July 9, 2014 Author Share Posted July 9, 2014 What the hell. Why do I need to destroy the ped element, I need the ped to be seen by only one person, the one who uses the commands, why should I use that server sided code? Link to comment
iPrestege Posted July 9, 2014 Share Posted July 9, 2014 What the hell. Why do I need to destroy the ped element, I need the ped to be seen by only one person, the one who uses the commands, why should I use that server sided code? As i said above you can't give a 'PED' Weapon which created from the client side you can deal with that by create an object and attaching it to the PED with bone_attach script. Link to comment
#DRAGON!FIRE Posted July 9, 2014 Share Posted July 9, 2014 local ped = { }; addCommandHandler( "ped", function ( player ) if ( isElement( ped[player] ) ) then destroyElement( ped[player] ) end ped[player] = createPed ( 100, 2707.11621, 2219.65137, 6.74981 ) if ( ped[player] ) then giveWeapon ( ped[player], 27, 500, true ) setElementVisibleTo ( ped[player], player, true ) setElementVisibleTo ( ped[player], root, false ) end end ) addEventHandler( "onPlayerQuit", root, function( ) if ( isElement( ped[source] ) ) then destroyElement( ped[source] ) ped[source] = nil end end ) Link to comment
EvilB12 Posted July 9, 2014 Author Share Posted July 9, 2014 What the hell. Why do I need to destroy the ped element, I need the ped to be seen by only one person, the one who uses the commands, why should I use that server sided code? As i said above you can't give a 'PED' Weapon which created from the client side you can deal with that by create an object and attaching it to the PED with bone_attach script. And if I do that, I won't be able to fire it, thats the point I am doing this, set ped's control state to fire the weapon Link to comment
#DRAGON!FIRE Posted July 9, 2014 Share Posted July 9, 2014 What the hell. Why do I need to destroy the ped element, I need the ped to be seen by only one person, the one who uses the commands, why should I use that server sided code? As i said above you can't give a 'PED' Weapon which created from the client side you can deal with that by create an object and attaching it to the PED with bone_attach script. And if I do that, I won't be able to fire it, thats the point I am doing this, set ped's control state to fire the weapon try my code Link to comment
MTA Team botder Posted July 9, 2014 MTA Team Share Posted July 9, 2014 I am not sure if it will work, but change the syncer serverside after the ped creation & giving a weapon: setElementSyncer(element, syncer) Link to comment
EvilB12 Posted July 9, 2014 Author Share Posted July 9, 2014 I tried setting the syncer to false, still doesn't work. Any ways I'll go with setting element alpha for other players P.S: Set element visible to, doesn't work either 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