
jkub
Members-
Posts
342 -
Joined
-
Last visited
Everything posted by jkub
-
nope... after a couple times of detaching it still stops working and U cant remove the objects. Ive even tried stopping and restarting the script... anything else I can do and/or is there anything else I am not doing right? I though destroying "v" as the attachedElements would do it. idk
-
Ok this is what I got right now. It seems to work so far but I havent got chance to test it real far?> Does it look right? function detachAll ( player ) local playerVehicle = getPlayerOccupiedVehicle ( player ) local attachedObjects = getAttachedElements ( playerVehicle ) for k, v in ipairs ( attachedObjects ) do destroyElement ( v ) end end addCommandHandler ( "detach", detachAll )
-
after some more testing i figured out that it was not just other attached objects it was deleting... it is deleting all objects... It removed A large ramp I had loaded on my map when I did the detach command it removed my ramp I had made for a map from another script
-
Here is the current script i got now local playerobj = {} addCommandHandler ( "attach", function ( player, cmd, objid, offsetx, offsety, offsetz, offsetrx, offsetry, offsetrz ) local playerVehicle = getPlayerOccupiedVehicle ( player ) playerobj[player] = createObject (tonumber ( objid ), 0, 0, 0 ) attachElementToElement ( playerobj[player], playerVehicle, offsetx, offsety, offsetz, offsetrx, offsetry, offsetrz ) end ) function detachAll ( player ) local playerVehicle = getPlayerOccupiedVehicle ( player ) for _, playerobj in pairs ( getElementsByType ( "object" ) ) do destroyElement ( playerobj ) end end addCommandHandler ( "detach", detachAll ) Now the 2 major problems with this is 1. The detach will only work a couple times and then It will stop working 2. The detach > detaches objects from other players vehicles that they have attached Wat Now... I put it in a table I think
-
I am making a small attach script And I need help with detaching all the objects that has been attached. This only works with one object and it is the last object attached wats the prob? function detachObject ( player ) local playerVehicle = getPlayerOccupiedVehicle ( player ) detachElementFromElement ( object[player], playerVehicle ) destroyElement ( object[player] ) outputChatBox ( "objects detached!", player, 0, 255, 0 ) end addCommandHandler ( "detach", detachObject ) Ive tried out getAttachedElements and tried that out didnt seem to help
-
Thanks:) the first method seemed to work. I had to move around some of my gui elements such as the buttons to get the pic to fit in their. I put it at the top and the text on the picture is kind of hard to read so im gonna make another picture for it with the text larger. How do I make the font size bigger on text labels Im trying to get some way for instructions when a player buys a time bomb or a dud bomb. Either a pic with the instrutions or somthin
-
ya its in the meta correctly and no errors
-
should I make it relative to the original window or what?...
-
I have a picture I have put together for a bomb shop script I am working on and I have a basic gui for it Buit I can not figure out how to get the picture im using into the gui??? I am using the Gui Classes for pretty much the whole gui I got everything set up in the meta already First I tried the way it was in gui classes like StaticImage:Create( int/float x, int/float y, int/float width, int/float height, string filename, [ bool relative = false, guielement parent = guiroot ] ) then I tried the original way from the wiki elementname = guiCreateStaticImage ( x, y, width, height, filename, relative, parent ) etc... Here is the main part of the gui function createGarageGui ( ) garageWindow = Window:Create ( .02, .3, .3, .6, "Car Bombs", true ) garageWindow:Visible ( false ) garageWindow:Movable ( false ) garageWindow:Sizable ( false ) showCursor ( false ) image = guiCreateStaticImage ( 0.5, 0.5, 0.5, 0.5, "bomb.png", true, garageWindow ) btnClsGarageGui = garageWindow:AddButton ( .35, .9, .3, .05, "Close", true ) btnEngineBomb = garageWindow:AddButton ( .25, .1, .5, .05, "Engine Bomb", true ) btnRemoteBomb = garageWindow:AddButton ( .25, .2, .5, .05, "Remote Bomb", true ) btnTimeBomb = garageWindow:AddButton ( .25, .3, .5, .05, "Time Bomb", true ) btnDudBomb = garageWindow:AddButton ( .25, .4, .5, .05, "Dud Bomb", true ) end addEventHandler ( "clientRequestsOpenGarageGui", getRootElement(), function ( ) garageWindow:Visible ( true ) showCursor ( true ) guiBringToFront ( garageWindow, true ) btnClsGarageGui:AddOnClick ( closeGarageGui ) btnEngineBomb:AddOnClick ( requestEngineBomb ) btnRemoteBomb:AddOnClick ( requestRemoteBomb ) btnTimeBomb:AddOnClick ( requestTimeBomb ) btnDudBomb:AddOnClick ( requestDudBomb ) end )
-
wats ur email? Maybe we can negotiate a deal or somthing.
-
as the beast philly himself Ive went through this before try this. It should work enterhouse = createMarker ( -1418.4084, -261.6748, 27.1063, "ring", 1, 25, 50, 39, 75 ) exithouse = createMarker ( 1298.8835, -795.8101, 1084.0078, "arrow", 1, 25, 155, 45, 100 ) function exitenter ( hitPlayer, matchingDimension ) if source == enterhouse then -- if the marker is the enterhouse marker setElementInterior ( hitPlayer, 5, 1272.9116, -768.9028, 1084.5097 ) elseif source == exithouse then -- if it is not enterhouse but the exithouse marker setElementInterior ( hitPlayer, 0, -1425.4689, -270.7399, 27.1067 ) end end addEventHandler ( "onMarkerHit", getRootElement(), exitenter ) If I am correct when you use the "onMarkerHit" event handler then the source for that handler is always the marker that was hit.
-
How would I use tostring to getsomeone elses ip? from what I understand Ive did this addCommandHandler ( "getip", function ( command, target ) target = tostring("") local targetName = getClientName ( target ) targetIP = getClientIP (target) outputChatBox ( targetName.. "'s IP is " ..targetIP, getRootElement() ) end )
-
Lol on the first page he said Ill let u "hear" some pics
-
Im trying to do a simple outputChatBox function for a a server part of a script. If the player does not have enough money it outputs the else message twice? and if he does have enough money it will output the purchased message once and right after it will output the else message also? never happend before? server side scriptVVV --Adjust Vehicle Prices BelowVVV-- bansheePrice = 20000 bulletPrice = 150000 CheetahPrice = 65000 cometPrice = 45000 elegyPrice = 25000 flashPrice = 25000 infernusPrice = 75000 jesterPrice = 35000 stratumPrice = 18000 sultanPrice = 32000 supergtPrice = 30000 turismoPrice = 80000 uranusPrice = 42000 windsorPrice = 38000 zr350Price = 50000 --Adjust Vehicle Prices Above^^^-- root = getRootElement() addEvent ( "clientRequestsBanshee", true ) addEvent ( "clientRequestsBullet", true ) addEvent ( "clientRequestsCheetah", true ) -------------------------------------------------------------------------------- shopMarker = createMarker ( -1954.3323, 295.0461, 35.4687, "cylinder", 1, 255, 0, 0, 125, root ) -------------------------------------------------------------------------------- function playerEntersShop ( marker ) if marker == shopMarker then triggerClientEvent( source, "clientRequestsOpenShopGui", root ) else end end addEventHandler ( "onPlayerMarkerHit", getRootElement(), playerEntersShop ) -------------------------------------------------------------------------------- addEventHandler ( "clientRequestsBanshee", root, function ( ) local money = getPlayerMoney ( client ) local x, y, z = getElementPosition ( client ) if money >= bansheePrice then takePlayerMoney ( client, bansheePrice ) createVehicle ( 429, x, y+5, z+1 ) outputChatBox ( "You have Purchased a Banshee", client, 100, 255, 0 ) else outputChatBox ( "You need more money for a Banshee>Cost$20000", client, 255, 255, 100 ) end end ) --------------------------------------------------------------------------------
-
WOW! how conveinent << (spell check) thanks!
-
I use command to open the gui but I eventually wanted to do it with a marker located at ammunation... I looked at your bank script to see how a hit marker would trigger the gui to come up for a client I seemed to do that right. Its pretty solid now but How would I extract this gui script to its own resource???
-
lol@ .... anyway how would i efficently define the event
-
client triggered serverside event onElementClicked but event is not marked as remotly triggerable addEvent ( "onButtonClicked", true )--make it remotley triggerable function onButtonClickedHandler ( event ) triggerServerEvent ( "onPlayerClick" ) end function coltBuy ( thePlayer ) giveWeapon ( thePlayer, 22, 35 ) end addEventHandler ( "onButtonClicked", getRootElement(), coltBuy )
-
So would I have to put the server functions in its own server side script right?
-
in that case set a timer inside the move object and btw if u want the object to move continuosly then why would u set a arrival location for it?
-
Hy Kabab Its philly.. anyway from what I understand You would like to lock the player in the marker until a certain command is entered. 1 Way to do this would be to disable the players controls like toggleAllControls ( thePlayer, false ) << That would completly freeze him or their is like toggleControl ( thePlayer, "forwards", false ) toggleControl ( thePlayer, "backwards", false ) toggleControl ( thePlayer, "left", false ) toggleControl ( thePlayer, "right", false ) ^^^disable the specific movement controls
-
wait... I think i caught myself is it because I am using "getPlayerMoney" which is a server function on a clientside script> is that it if it is how would I link this correctly to the server script?
-
omg lol I am foolish. I got that now and it now works but my next prob is a button I click to buy a gun I use cash = getPlayerMoney ( thePlayer ) to get the cash but It says that getPlayerMoney is a nil value function colt () local cash = getPlayerMoney ( thePlayer ) if ( cash < 350 ) then outputChatBox ( "You need $350 for this weapon", thePlayer ) else giveWeapon ( thePlayer, 22, 35, true ) takePlayerMoney ( thePlayer, 350 ) end end
-
i put that code in and it says attempt to index a global window a nil value...?