Jump to content

Got a little problem! Nearly Solved!


Maurize

Recommended Posts

Posted (edited)

So. I try to create an explosion when the player shoots..

I don´t know what i must add here.. i think i forgot it :(

And yes i know its kinda copy of mta sa wiki cause this script isn´t much longer..

This script should let the shooting look like real.

The screen must shake! xD

function explosionOnShoot ( )
if  
*DONO WHAT I SHOULD WRITE HERE*
then
local pX, pY, pZ = getElementPosition ( source )
createExplosion ( pX, pY, pZ, 6, source )
end
addEventHandler ( "onPlayerShoot", getRootElement(), explosionOnShoot )

Edited by Guest
Posted

this is the point. i can´t find the right thing on Mta sa wiki.

I need something like OnPlayerFire ..

otherwise I must create a whole new event o.O

Isnt there something like:

OnButtonDown or something ??

Posted

noo.. even doesnt work .. :( look:

function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip)
local pX, pY, pZ = getElementPosition ( source )
 
if (weapon == 22) then
createExplosion(pX, pY, pZ, 6, source)
end
end
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc)

Posted

do not bump threads in few minutes :/ (to all thinking it was whole hour - he edited)

edit: why do you want to create explosion ON PLAYER? not on the hit position?

and why you are creating this explosion only for local player?

Posted

I want that the whole screen rumbles when player shoots with a gun.

In real the recoil would let the body of a human shake, so his eyes shake even.

Only the player which shoots the weapon should see the rumble.

..

thats what i try to get..

Posted

and you are creating an explosion to achive it?

btw: you are using server syntax on client side..

client syntax is:

bool createExplosion ( float x, float y, float z, int type [, bool makeSound = true, float camShake = -1.0, bool damaging = true ] )

Posted

oh my holy shit.. it works..

You are the best maan!

( Only forgot to set it in meta to client ^^)

BUT

Now i always see this explosion.. can i make it invisible??

somethig like :

getElement .. setVisibile ( 0,...

Posted

I think there was a type of explosion that was invisible... Maybe it was in SAMP era and it could have been a bug.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...