Jump to content

Script doesn't work


CrazyDude69

Recommended Posts

the code will not have problems, remember that it ClientSide (type="client") and this event is triggered when any player spawns and must have a function with projectile.

You can also use ServerSide which only activated for the player

onPlayerSpawn

I have function projectile, just don't posted it, this function works, so problem don't in it :\

Link to comment
the code will not have problems, remember that it ClientSide (type="client") and this event is triggered when any player spawns and must have a function with projectile.

You can also use ServerSide which only activated for the player

onPlayerSpawn

I have function projectile, just don't posted it, this function works, so problem don't in it :\

Link to comment

If only both of you zorrigas and ThePope have ever read the first message you'd know

Hi everyone, look at my script: http://mta.pastebay.com/82749

Why the hell, when player spawns, keys not binding? If i trigerring this function with addCommandHandler, everything is ok, but if i trigerring this with addEventHandler, nothing happens, and this is client side script, and /debugscript 3 don't see errors or warning :\

And rootElement = getRootElement()

:roll:

@CrazyDude69, bindKey has always been pain in the butt in onClientPlayerSpawn, onPlayerSpawn, onPlayerJoin and onResourceStart. These are the events I've experienced this problem since DP1. Try to make a delay. Let the player spawn, set a timer for 1 second which will bind their key.

Link to comment

If only both of you zorrigas and ThePope have ever read the first message you'd know

Hi everyone, look at my script: http://mta.pastebay.com/82749

Why the hell, when player spawns, keys not binding? If i trigerring this function with addCommandHandler, everything is ok, but if i trigerring this with addEventHandler, nothing happens, and this is client side script, and /debugscript 3 don't see errors or warning :\

And rootElement = getRootElement()

:roll:

@CrazyDude69, bindKey has always been pain in the butt in onClientPlayerSpawn, onPlayerSpawn, onPlayerJoin and onResourceStart. These are the events I've experienced this problem since DP1. Try to make a delay. Let the player spawn, set a timer for 1 second which will bind their key.

Link to comment

hey everyone again! I have one problem, i have client-side script, i created this function:

function isPedDriver( ped, vehicle )
local pedIn = GetVehicleOccupant( vehicle, 0 )
if pedIn == ped then
return true
else
return false
end
end

This function checks, if "ped" sitting in "vehicle" as driver (driver seat 0), if yes, returns true, if not, returns false, and yes, before i using this function, i check if player in vehicle, so when i use it, i get that in debugscript:

errorp.png

Link to comment

hey everyone again! I have one problem, i have client-side script, i created this function:

function isPedDriver( ped, vehicle )
local pedIn = GetVehicleOccupant( vehicle, 0 )
if pedIn == ped then
return true
else
return false
end
end

This function checks, if "ped" sitting in "vehicle" as driver (driver seat 0), if yes, returns true, if not, returns false, and yes, before i using this function, i check if player in vehicle, so when i use it, i get that in debugscript:

errorp.png

Link to comment
  • 2 weeks later...

Hello guys, i have a new problem...

I have clientside function:

function rendering()
if (draw) then
dxDrawImage(screenWidth/2-16,screenHeight/2-70,32,32,"data/cur.png")
	elem = getElementsByType("vehicle")
for key,value in pairs(elem) do
local veh = getPedOccupiedVehicle(player)
if isElementOnScreen(value) and veh ~= value then
local ex,ey,ez = getElementPosition(value)
local px,py,pz = getElementPosition(player)
local dis = getDistanceBetweenPoints3D(ex,ey,ez,px,py,pz)
if dis < 50 and isLineOfSightClear(ex,ey,ez,px,py,pz,true,false,false,false) then
local x,y = getScreenFromWorldPosition(ex,ey,ez)
local hp = getElementHealth(value)
if x and hp ~= 0 then
					hp = hp/10000
dxDrawRectangle(x-62.5, y, 125, 25, tocolor(0,0,0,100))
dxDrawRectangle(x-59.5, y+3, 119*hp, 19, tocolor(255,0,0,200))
end
end
end
end
end
end
addEventHandler("onClientRender", getRootElement(), rendering)

and i have:

function setHealthC(theVehicle)
local vx, vy, vz = getElementPosition(theVehicle)
local vrx, vry, vrz = getElementRotation(theVehicle)
setElementHealth(theVehicle, 10000.0)
military = createObject(3884, vx,vy,vz+1,vrx,vry,vrz)
setObjectStatic(military, true)
setElementCollisionsEnabled(military, false)
attachElements(military, theVehicle)
end
 
addEventHandler("onClientPlayerVehicleEnter", getRootElement(), setHealthC)

So there is a problem: When i enter car, and looking how many my car have health, it's write's that i have 10000 health, when i exit, now i can see that car HP bar, and it shows that this car has about 1000hp, so hp bar is not full, also when i'm in car, and other players looking at my car HP bar, they see that thing too, that hp bar is not full, only 1 time, it showed me full bar, but when i rejoined from car, i again see, that hp bar is not full, i think the problem in desync with client and server, but maybe no? I hope u will help me!

Link to comment

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...