Stevenn
-
Posts
97 -
Joined
-
Last visited
Posts posted by Stevenn
-
-
why do you need getElementPosition ? you need it to check the CURRENT location of the player?
no, but i tried without, any i had no succes either so..
-
Oh, what an idiot i am,
debug message: bad arguement @ 'getElementPosition'
-
tahnks!
-
Alright, it works perfectly thank ya'll. (I decided to use it serversided)
-
well its rather obvious isn't it? i can't test the code atm as im not on my normal PC
-
yes, i forgot to add this. but this is what i got so far
function createMarkerOnVehicleEnter () if getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == myid then triggerEvent ( "my event", localPlayer ) end addEventHandler ( "onClientVehicleEnter", root, createMarkerOnVehicleEnter )
-
Hello, i got an question, i want when a client enters a vehicle, and if the vehicle id is a special one then it will trigger an event
but im new to this kind of things and i don't know how to do it.
could anyone help out with givng an example?
-
how can I use it like this:
if ( hitElement == localPlayer and source == cMarker and isTruck(lp) ) then
and
function isTruck(lp) if ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) then return true end end
or
if ( hitElement == localPlayer and source == cMarker and ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) ) then
none of them works, bad argument..
-
hey, im trying to use
local lp = getLocalPlayer() if getElementModel(getPedOccupiedVehicle(lp)) == 437
but it gives me: bad argument @ 'getElementModel'
-
if ( source == cMarker and hitElement == localPlayer ) then
?
-
Well, when I hit the "cMarker" I want to trigger the server event, but like I said: Expected element at argument 2, got nil
-
anyone?
-
First, why you need "theVehicle" parameter in 'onClickCreateMarker' event? Also, what is "lp".
because i was trying something but i remove it, and lp = getLocalPlayer()
-
ty it works draken, but how can I do this ?
addEventHandler ( "onClientMarkerHit", cMarker , function ( ) if getElementModel(getPedOccupiedVehicle(lp)) == 437 then triggerServerEvent ( "busStop", lp ) end end )
bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
cMarker is not global. You must remove "local" before cMarker in the code to use it in other functions.
addEventHandler ( 'onClickCreateMarker', root, function ( ) local nX, nY, nZ = getRandomLocation ( ); cMarker = createMarker ( nX, nY, nZ, "cylinder",4,250,250,255 ); local blip = createBlipAttachedTo ( cMarker, 53 ); end ) addEventHandler ( "onClientMarkerHit", cMarker, function ( ) triggerServerEvent ( "truckStop", localPlayer ) end )
doesn't work...
-
ty it works draken, but how can I do this ?
addEventHandler ( "onClientMarkerHit", cMarker , function ( ) if getElementModel(getPedOccupiedVehicle(lp)) == 437 then triggerServerEvent ( "busStop", lp ) end end )
bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
-
still bad argument at createMarker..
-
i dont know what i am doing wrong
bad argument @ 'createMarker'
local locationTable = { { -2128, -80, 36 }, } function getRandomLocation ( ) return unpack ( locations [ math.random ( #locationTable ) ] ) end function buttonClick(button) if (button) ~= "left" then return end if (source == acceptJob) then triggerEvent ( "markerLocation3",lp ) end end addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) addEvent ( "markerLocation3", true) function markerLocation () markerLocation2 = createMarker ( x, y, z, "cylinder",250,250,250 ) blip = createBlipAttachtedTo ( markerLocation2, 53 ) end addEventHandler("markerLocation3",root,markerLocation) acceptJob = guiCreateButton(37,58,94,49,"Accept",false,truckWindow)
-
Thank you for the really fast reply, as always.
But, if I'm gonna create a marker at one of those, how would I do that?
outputChatBox ( "my message" ..locations.. "hehe" ) mymarker = createMarker (locations, "cylinder", 1.5, 255, 255, 0, 170 )
I'm probably wrong but..
-
local randomMoney = math.random ( 200, 500 ) givePlayerMoney ( randomMoney ) outputChatBox ( "well done you have earned ".. randomMoney .."$" )
Oh, looks like I wasn't that gone after all, now, if I need to give the player a random location every time and then output in chatbox which location they got and create a marker at that
I have absolutely no idea how to do it, and I'd appreciate some help
like (i know this is obviously wrong)
outputChatBox("Now depart to" ..location.. "to get your next pay") -- where location will be randomly choosen from a table (x,y,x) and a name attached to it, like location = { [jefferson]=x,y,z, [allsaints]=x,y,z
-
Okay so, im trying to do a job, but i need to know can i give a player a random pay, should i use math.random or random from a table?
like
givePlayerMoney(math.random (200, 500))
would give the player a random pay from 200-500? and, if i use any of those alternative how can I output it in chatbox like
givePlayerMoney(math.random (200, 500)) outputChatBox("well done you have earned" ..what_to_pu_here.. "$")
-
okay, but is it possible to bind the sound into a comamnand?
-
lol, it's 4:50 am and i'm quite tired, i obviously meant onClientResourceStart and it works now, thanks for the sarcastic comment though solid.
@Jay thanks.
-
function dxText ( ) dxDrawText("my message",511.0,354.0,995.0,637.0,tocolor(255,255,255,255),1.5,"pricedown","left","top",false,false,false) end addEventHandler('onClientResourceRoot', root, function(reason) addEventHandler ( "onClientRender", root, dxText ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, dxText ) end ,5000,1 ) end )
no debugs, but no message either.
-
That's because every time you join, you download the client side resources and that triggers "onClientResourceStart".
oh, is it possible to not make it trigger?
try this:
addEventHandler ( "onClientPlayerJoin", root,function( ) sound = playSound ("files/mission.mp3", false ) setSoundVolume ( sound, 1.0 ) end)
wouldn't that specifically play the sound when i join? i want it to only play when i restart the resource.
getZoneName()
in Scripting
Posted · Edited by Guest
solved, thanks.