Puma Posted April 21, 2012 Share Posted April 21, 2012 Clientside rx, ry, rz = getElementRotation( source ) is the problem (line . Since 'source' is a player = ped and peds only have a Z-rotation. You must use getPedRotation. Also, I would make the variables local. https://wiki.multitheftauto.com/wiki/GetPedRotation X- and y-rotation will be 0. Change this line: rx, ry, rz = getElementRotation( source ) Into this: local rx, ry = 0, 0 local rz = getPedRotation( source ) Worth a try . Link to comment
Charlie_Jefferson Posted April 21, 2012 Author Share Posted April 21, 2012 Oh yeah, I totally forgot >.>. Edit: Did some tweaks to it and it works. However, I still don't know how to give them a continuous ID, like make a roadblock and set it to ID 1, then make another one, ID 2 and so on. That would help me make a delete roadblock command. Link to comment
Charlie_Jefferson Posted April 21, 2012 Author Share Posted April 21, 2012 Unnecessarily bump. I got this code: Server-side addEvent ( "objcrt", true ); addEventHandler ( "objcrt", root, function ( chk ) outputChatBox ( tostring ( chk ) ); -- check here what outputs toggleAllControls ( source, true ); showCursor ( source, false ); local nX, nY, nZ = getElementPosition ( source ); local nX2, nY2 = 0, 0 local nZ2 = getPedRotation( source ) if ( chk == 0 ) then rbobj0 = createObject(1459, nX, nY, nZ-0.5, nX2, nY2, nZ2); elseif ( chk == 1 ) then rbobj1 = createObject(1424, nX, nY, nZ-0.5, nX2, nY2, nZ2); elseif ( chk == 2 ) then rbobj2 = createObject(1425, nX, nY, nZ-0.5, nX2, nY2, nZ2); elseif ( chk == 3 ) then rbobj3 = createObject(1423, nX, nY, nZ-0.2, nX2, nY2, nZ2); elseif chk == 4 then rbobj3 = createObject(981, nX, nY, nZ-0.5, nX2, nY2, nZ2); elseif chk == 5 then rbobj4 = createObject(978, nX, nY, nZ-0.5, nX2, nY2, nZ2); end end ) Client-side local tRBNames = { [ 'roadright' ] = 'Small roadblock'; [ 'helix_barrier' ] = 'Big Street Roadblock'; [ 'roadworkbarrier1' ] = 'Sidewalk Roadblock'; [ 'roadbarrier4' ] = 'Barrier'; [ 'roadbarrier3' ] = 'Detour sign'; [ 'roadbarrier6' ] = 'Small barrier'; } function cGUI() showCursor(true) toggleAllControls(true) rbsWindow = guiCreateWindow(0.3391,0.2832,0.3125,0.4688,"Roadblock System",true) guiWindowSetSizable(rbsWindow,false) acceptButton = guiCreateButton(0.1075,0.8813,0.3225,0.0854,"Accept",true,rbsWindow) closeButton = guiCreateButton(0.57,0.8813,0.3225,0.0854,"Close",true,rbsWindow) rbsMenu = guiCreateGridList(0.11,0.1292,0.785,0.725,true,rbsWindow) guiGridListSetSelectionMode(rbsMenu,2) guiGridListAddColumn(rbsMenu,"Roadblocks",0.90) for _, sObject in pairs ( tRBNames ) do -- pairs, not ipairs if ( rbsMenu ) then local row = guiGridListAddRow ( rbsMenu ) guiGridListSetItemText ( rbsMenu, row, 1, tostring ( sObject ), false, false ) end end addEventHandler("onClientGUIClick", root, function ( ) if ( source == acceptButton ) then local chk = guiGridListGetSelectedItem ( rbsMenu ) if ( chk ) then triggerServerEvent("objcrt", localPlayer, chk) --localPlayer, not root guiSetVisible(rbsWindow, false) end elseif ( source == closeButton ) then guiSetVisible(rbsWindow, false) toggleAllControls(true) showCursor(false) end end ) end addCommandHandler ( 'rb', cGUI ) How do I make it so that every time I spawn an object, the ID to the object spawned is set? Like, the start ID will be 0, when I spawn an object it will be 1, the next object is 2, without taking the objects in order and so on. 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