WASSIm. Posted October 16, 2013 Share Posted October 16, 2013 (edited) hi guys i want make functions weapon server side like createWeapon and setWeaponOwner... but have problem Client function oncreateWeapon( theWeapon, x, y, z ) createWeapon(theWeapon, x, y, z ) end function onfireWeapon( theWeapon ) fireWeapon(theWeapon) end function ongetWeaponState( theWeapon ) getWeaponState(theWeapon) end function ongetWeaponTarget( theWeapon ) getWeaponTarget(theWeapon) end function ongetWeaponOwner( theWeapon ) getWeaponOwner(theWeapon) end function ongetWeaponFlags( theWeapon ) getWeaponOwner(theWeapon) end function ongetWeaponAmmo( theWeapon ) getWeaponAmmo(theWeapon) end function ongetWeaponClipAmmo( theWeapon ) getWeaponClipAmmo(theWeapon) end function onresetWeaponFiringRate( theWeapon ) resetWeaponFiringRate(theWeapon) end function onsetWeaponProperty( theWeapon, strProperty, theValue ) setWeaponProperty(theWeapon,strProperty,theValue) end function onsetWeaponState( theWeapon, theState ) setWeaponState(theWeapon,theState) end function onsetWeaponTarget( theWeapon, theTarget, iComponentID ) setWeaponTarget(theWeapon,theTarget,iComponentID) end function onsetWeaponOwner( theWeapon, theOwner ) setWeaponOwner(theWeapon,theOwner) end function onsetWeaponFlags( theWeapon, theFlag, theValue ) setWeaponFlags(theWeapon,theOwner) end function onsetWeaponFiringRate( theWeapon, firingRate ) setWeaponFiringRate(theWeapon,firingRate) end function onsetWeaponAmmo( theWeapon, Ammo ) setWeaponAmmo(theWeapon,Ammo) end function onsetWeaponClipAmmo( theWeapon, clipAmmo ) setWeaponClipAmmo(theWeapon,clipAmmo) end addEvent ( "oncreateWeapon", true ) addEvent ( "onfireWeapon", true ) addEvent ( "ongetWeaponState", true ) addEvent ( "ongetWeaponTarget", true ) addEvent ( "ongetWeaponOwner", true ) addEvent ( "ongetWeaponFlags", true ) addEvent ( "ongetWeaponAmmo", true ) addEvent ( "ongetWeaponClipAmmo", true ) addEvent ( "onresetWeaponFiringRate", true ) addEvent ( "onsetWeaponProperty", true ) addEvent ( "onsetWeaponState", true ) addEvent ( "onsetWeaponTarget", true ) addEvent ( "onsetWeaponOwner", true ) addEvent ( "onsetWeaponFlags", true ) addEvent ( "onsetWeaponFiringRate", true ) addEvent ( "onsetWeaponAmmo", true ) addEvent ( "onsetWeaponClipAmmo", true ) addEventHandler ( "oncreateWeapon", getRootElement(), oncreateWeapon ) addEventHandler ( "onfireWeapon", getRootElement(), onfireWeapon ) addEventHandler ( "ongetWeaponState", getRootElement(), ongetWeaponState ) addEventHandler ( "ongetWeaponTarget", getRootElement(), ongetWeaponTarget ) addEventHandler ( "ongetWeaponOwner", getRootElement(), ongetWeaponOwner ) addEventHandler ( "ongetWeaponFlags", getRootElement(), ongetWeaponFlags ) addEventHandler ( "ongetWeaponAmmo", getRootElement(), ongetWeaponAmmo ) addEventHandler ( "ongetWeaponClipAmmo", getRootElement(), ongetWeaponClipAmmo ) addEventHandler ( "onresetWeaponFiringRate", getRootElement(), onresetWeaponFiringRate ) addEventHandler ( "onsetWeaponProperty", getRootElement(), onsetWeaponProperty ) addEventHandler ( "onsetWeaponState", getRootElement(), onsetWeaponState ) addEventHandler ( "onsetWeaponTarget", getRootElement(), onsetWeaponTarget ) addEventHandler ( "onsetWeaponOwner", getRootElement(), onsetWeaponOwner) addEventHandler ( "onsetWeaponFlags", getRootElement(), onsetWeaponFlags) addEventHandler ( "onsetWeaponFiringRate", getRootElement(), onsetWeaponFiringRate) addEventHandler ( "onsetWeaponAmmo", getRootElement(), onsetWeaponAmmo) addEventHandler ( "onsetWeaponClipAmmo", getRootElement(), onsetWeaponClipAmmo) Server function createWeapon( theWeapon, x, y, z ) triggerClientEvent ( "oncreateWeapon", getRootElement(), theWeapon, x, y, z ) end function fireWeapon( theWeapon ) triggerClientEvent ( "onfireWeapon", getRootElement(), theWeapon ) end function getWeaponState( theWeapon ) triggerClientEvent ( "ongetWeaponState", getRootElement(), theWeapon ) end function getWeaponTarget( theWeapon ) triggerClientEvent ( "ongetWeaponTarget", getRootElement(), theWeapon ) end function getWeaponOwner( theWeapon ) triggerClientEvent ( "ongetWeaponOwner", getRootElement(), theWeapon ) end function getWeaponFlags( theWeapon ) triggerClientEvent ( "ongetWeaponFlags", getRootElement(), theWeapon ) end function getWeaponAmmo( theWeapon ) triggerClientEvent ( "ongetWeaponAmmo", getRootElement(), theWeapon ) end function getWeaponClipAmmo( theWeapon ) triggerClientEvent ( "ongetWeaponClipAmmo", getRootElement(), theWeapon ) end function resetWeaponFiringRate( theWeapon ) triggerClientEvent ( "onresetWeaponFiringRate", getRootElement(), theWeapon ) end function setWeaponProperty( theWeapon, strProperty, theValue ) triggerClientEvent ( "onsetWeaponProperty", getRootElement(), theWeapon, strProperty, theValue ) end function setWeaponState( theWeapon, theState ) triggerClientEvent ( "onsetWeaponState", getRootElement(), theWeapon, theState ) end function setWeaponTargete( theWeapon, theTarget, iComponentID ) triggerClientEvent ( "onsetWeaponTarget", getRootElement(), theWeapon, theTarget, iComponentID ) end function setWeaponOwner( theWeapon, theOwner ) triggerClientEvent ( "onsetWeaponOwner", getRootElement(), theWeapon, theOwner ) end function setWeaponFlags( theWeapon, theFlag, theValue ) triggerClientEvent ( "onsetWeaponFlags", getRootElement(), theWeapon, theFlag, theValue ) end function setWeaponFiringRate( theWeapon, firingRate ) triggerClientEvent ( "onsetWeaponFiringRate", getRootElement(), theWeapon, firingRate ) end function setWeaponAmmo( theWeapon, Ammo ) triggerClientEvent ( "onsetWeaponAmmo", getRootElement(), theWeapon, Ammo ) end function setWeaponClipAmmo( theWeapon, clipAmmo ) triggerClientEvent ( "onsetWeaponClipAmmo", getRootElement(), theWeapon, clipAmmo ) end this Test Exmple (Server side) function createMinigunWeapon(player) local x, y, z = getElementPosition(player) local weapon = createWeapon("minigun", x, y, z + 1) setWeaponClipAmmo ( weapon,99999) setWeaponState ( weapon,"firing") end addCommandHandler("createminigun", createMinigunWeapon) tell me in debug: Edited October 16, 2013 by Guest Link to comment
slotman Posted October 16, 2013 Share Posted October 16, 2013 delete Client server server you mode /upgrade all function createMinigunWeapon() local x, y, z = getElementPosition(getLocalPlayer()) local weapon = createWeapon("minigun", x, y, z + 1) setWeaponClipAmmo ( weapon,99999) setWeaponState ( weapon,"firing") end addCommandHandler("createminigun", createMinigunWeapon) https://wiki.multitheftauto.com/wiki/CreateWeapon Link to comment
WASSIm. Posted October 16, 2013 Author Share Posted October 16, 2013 delete Client server server you mode /upgrade all function createMinigunWeapon() local x, y, z = getElementPosition(getLocalPlayer()) local weapon = createWeapon("minigun", x, y, z + 1) setWeaponClipAmmo ( weapon,99999) setWeaponState ( weapon,"firing") end addCommandHandler("createminigun", createMinigunWeapon) https://wiki.multitheftauto.com/wiki/CreateWeapon i testing script with functions weapons server side Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 Where are you storing the weapon elements? Link to comment
WASSIm. Posted October 16, 2013 Author Share Posted October 16, 2013 Where are you storing the weapon elements? storing the weapon elements ? Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 Yeah, the client side weapon elements doesn't exist in the server side ( obviously ). Link to comment
WASSIm. Posted October 16, 2013 Author Share Posted October 16, 2013 Yeah, the client side weapon elements doesn't exist in the server side ( obviously ). but weapon created and all player can see Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 But the element exists individually on each client, how are you assigning them server-side? Link to comment
WASSIm. Posted October 16, 2013 Author Share Posted October 16, 2013 i use like this. but its before i make script swat tank shot minigun and i lost that script Client function oncreateWeapon( theWeapon, x, y, z ) createWeapon(theWeapon, x, y, z ) end function onfireWeapon( theWeapon ) fireWeapon(theWeapon) end function ongetWeaponState( theWeapon ) getWeaponState(theWeapon) end function ongetWeaponTarget( theWeapon ) getWeaponTarget(theWeapon) end function ongetWeaponOwner( theWeapon ) getWeaponOwner(theWeapon) end function ongetWeaponFlags( theWeapon ) getWeaponOwner(theWeapon) end function ongetWeaponAmmo( theWeapon ) getWeaponAmmo(theWeapon) end function ongetWeaponClipAmmo( theWeapon ) getWeaponClipAmmo(theWeapon) end function onresetWeaponFiringRate( theWeapon ) resetWeaponFiringRate(theWeapon) end function onsetWeaponProperty( theWeapon, strProperty, theValue ) setWeaponProperty(theWeapon,strProperty,theValue) end function onsetWeaponState( theWeapon, theState ) setWeaponState(theWeapon,theState) end function onsetWeaponTarget( theWeapon, theTarget, iComponentID ) setWeaponTarget(theWeapon,theTarget,iComponentID) end function onsetWeaponOwner( theWeapon, theOwner ) setWeaponOwner(theWeapon,theOwner) end function onsetWeaponFlags( theWeapon, theFlag, theValue ) setWeaponFlags(theWeapon,theOwner) end function onsetWeaponFiringRate( theWeapon, firingRate ) setWeaponFiringRate(theWeapon,firingRate) end function onsetWeaponAmmo( theWeapon, Ammo ) setWeaponAmmo(theWeapon,Ammo) end function onsetWeaponClipAmmo( theWeapon, clipAmmo ) setWeaponClipAmmo(theWeapon,clipAmmo) end addEvent ( "oncreateWeapon", true ) addEvent ( "onfireWeapon", true ) addEvent ( "ongetWeaponState", true ) addEvent ( "ongetWeaponTarget", true ) addEvent ( "ongetWeaponOwner", true ) addEvent ( "ongetWeaponFlags", true ) addEvent ( "ongetWeaponAmmo", true ) addEvent ( "ongetWeaponClipAmmo", true ) addEvent ( "onresetWeaponFiringRate", true ) addEvent ( "onsetWeaponProperty", true ) addEvent ( "onsetWeaponState", true ) addEvent ( "onsetWeaponTarget", true ) addEvent ( "onsetWeaponOwner", true ) addEvent ( "onsetWeaponFlags", true ) addEvent ( "onsetWeaponFiringRate", true ) addEvent ( "onsetWeaponAmmo", true ) addEvent ( "onsetWeaponClipAmmo", true ) addEventHandler ( "oncreateWeapon", getRootElement(), oncreateWeapon ) addEventHandler ( "onfireWeapon", getRootElement(), onfireWeapon ) addEventHandler ( "ongetWeaponState", getRootElement(), ongetWeaponState ) addEventHandler ( "ongetWeaponTarget", getRootElement(), ongetWeaponTarget ) addEventHandler ( "ongetWeaponOwner", getRootElement(), ongetWeaponOwner ) addEventHandler ( "ongetWeaponFlags", getRootElement(), ongetWeaponFlags ) addEventHandler ( "ongetWeaponAmmo", getRootElement(), ongetWeaponAmmo ) addEventHandler ( "ongetWeaponClipAmmo", getRootElement(), ongetWeaponClipAmmo ) addEventHandler ( "onresetWeaponFiringRate", getRootElement(), onresetWeaponFiringRate ) addEventHandler ( "onsetWeaponProperty", getRootElement(), onsetWeaponProperty ) addEventHandler ( "onsetWeaponState", getRootElement(), onsetWeaponState ) addEventHandler ( "onsetWeaponTarget", getRootElement(), onsetWeaponTarget ) addEventHandler ( "onsetWeaponOwner", getRootElement(), onsetWeaponOwner) addEventHandler ( "onsetWeaponFlags", getRootElement(), onsetWeaponFlags) addEventHandler ( "onsetWeaponFiringRate", getRootElement(), onsetWeaponFiringRate) addEventHandler ( "onsetWeaponAmmo", getRootElement(), onsetWeaponAmmo) addEventHandler ( "onsetWeaponClipAmmo", getRootElement(), onsetWeaponClipAmmo) Server function createWeapon( theWeapon, x, y, z ) triggerClientEvent ( "oncreateWeapon", getRootElement(), theWeapon, x, y, z ) end function fireWeapon( theWeapon ) triggerClientEvent ( "onfireWeapon", getRootElement(), theWeapon ) end function getWeaponState( theWeapon ) triggerClientEvent ( "ongetWeaponState", getRootElement(), theWeapon ) end function getWeaponTarget( theWeapon ) triggerClientEvent ( "ongetWeaponTarget", getRootElement(), theWeapon ) end function getWeaponOwner( theWeapon ) triggerClientEvent ( "ongetWeaponOwner", getRootElement(), theWeapon ) end function getWeaponFlags( theWeapon ) triggerClientEvent ( "ongetWeaponFlags", getRootElement(), theWeapon ) end function getWeaponAmmo( theWeapon ) triggerClientEvent ( "ongetWeaponAmmo", getRootElement(), theWeapon ) end function getWeaponClipAmmo( theWeapon ) triggerClientEvent ( "ongetWeaponClipAmmo", getRootElement(), theWeapon ) end function resetWeaponFiringRate( theWeapon ) triggerClientEvent ( "onresetWeaponFiringRate", getRootElement(), theWeapon ) end function setWeaponProperty( theWeapon, strProperty, theValue ) triggerClientEvent ( "onsetWeaponProperty", getRootElement(), theWeapon, strProperty, theValue ) end function setWeaponState( theWeapon, theState ) triggerClientEvent ( "onsetWeaponState", getRootElement(), theWeapon, theState ) end function setWeaponTargete( theWeapon, theTarget, iComponentID ) triggerClientEvent ( "onsetWeaponTarget", getRootElement(), theWeapon, theTarget, iComponentID ) end function setWeaponOwner( theWeapon, theOwner ) triggerClientEvent ( "onsetWeaponOwner", getRootElement(), theWeapon, theOwner ) end function setWeaponFlags( theWeapon, theFlag, theValue ) triggerClientEvent ( "onsetWeaponFlags", getRootElement(), theWeapon, theFlag, theValue ) end function setWeaponFiringRate( theWeapon, firingRate ) triggerClientEvent ( "onsetWeaponFiringRate", getRootElement(), theWeapon, firingRate ) end function setWeaponAmmo( theWeapon, Ammo ) triggerClientEvent ( "onsetWeaponAmmo", getRootElement(), theWeapon, Ammo ) end Link to comment
Castillo Posted October 16, 2013 Share Posted October 16, 2013 It doesn't make any sense, weapons are never stored, that'll never work. Link to comment
WASSIm. Posted October 16, 2013 Author Share Posted October 16, 2013 It doesn't make any sense, weapons are never stored, that'll never work. but its working in swat tank shot minigun and i can kill players 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