aymeness81 Posted July 27, 2014 Share Posted July 27, 2014 I wanted to trigger a server event, Its about giveWeapon But I want it to be triggered like the following, For example I will add the event of giveWeapon in serverside named as "giveWeaponToPlayer" But the only problem, is that the arguments are attached to client side. the ammo is to get gui label text. so someone can make it like that? triggerServerEvent("giveWeaponToPlayer", player thePlayer, int ID, int Ammo) For example this adds "spawnvehicle" event. local vehicles = { } addEvent ( "spawnvehicle", true ) addEventHandler ( "spawnvehicle", root, function ( vehID ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) if ( vehicles [ source ] ) then setVehicleColor ( vehicles [ source ], 255, 255, 255 ) end setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) triggerClientEvent ( source, "closeWindow", root ) end ) And when we trigger it on client side it'd be like that: triggerServerEvent("spawnvehicle", player, vehID) Thanks for advance, Every help is appreciated! Link to comment
DNL291 Posted July 27, 2014 Share Posted July 27, 2014 Is that what you meant? addEvent( "giveWeaponToPlayer", true ) addEventHandler( "giveWeaponToPlayer", root, function (weapon, ammo) if weapon then giveWeapon(client, tonumber(weapon), (tonumber(ammo) or 30), true) end end ) triggerServerEvent("giveWeaponToPlayer", localPlayer, 30, 500) Link to comment
aymeness81 Posted July 27, 2014 Author Share Posted July 27, 2014 Is that what you meant? addEvent( "giveWeaponToPlayer", true ) addEventHandler( "giveWeaponToPlayer", root, function (weapon, ammo) if weapon then giveWeapon(client, tonumber(weapon), (tonumber(ammo) or 30), true) end end ) triggerServerEvent("giveWeaponToPlayer", localPlayer, 30, 500) Yeah, Thanks 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