-
Posts
139 -
Joined
-
Last visited
Everything posted by HustraDev
-
i need help guy's ..
-
client ------------------- Gridlist ------------------ PlayerVehicleList = guiCreateGridList(9, 24, 407, 129, false, wndPVList) guiGridListAddColumn(PlayerVehicleList, "ID", 0.3) guiGridListAddColumn(PlayerVehicleList, "Name", 0.3) guiGridListAddColumn(PlayerVehicleList, "Price", 0.3) ------------------------------------------------ ------ Note : The same column we have in db table are exist in gridlist addEvent("SendRows",true) addEventHandler("SendRows",getRootElement(), function(result) for column, value in pairs ( result ) do local row = guiGridListAddRow ( PlayerVehicleList ) guiGridListSetItemText ( PlayerVehicleList, row, 1, value[1], false, false ) guiGridListSetItemText ( PlayerVehicleList, row, 2, value[2], false, false ) end end ) server addEvent("SelectRows",true) addEventHandler("SelectRows",getRootElement(), function() local rows = dbQuery( connection, "SELECT * FROM `VList` WHERE `account`=?",getAccountName(getPlayerAccount(client))) local result = dbPoll( rows, -1 ) triggerClientEvent(source,"SendRows",getRootElement(),result) end )
-
Any Help!?
-
server local connection = dbConnect( "sqlite", "database.db" ) addEvent("SelectRows",true) addEventHandler("SelectRows",getRootElement(), function() local rows = dbQuery( connection, "SELECT * FROM `VList` WHERE `account`=?",getAccountName(getPlayerAccount(client)) ) local result = dbPoll( rows, -1 ) end ) client bindKey("F2", "down", function () guiSetVisible ( wndPVList, false ) triggerServerEvent("SelectRows", localPlayer) showCursor(true) end )
-
Hello guys, i have difficult in Inserting a row's from a custom database into a GUI grid list could any one help me i tried to make a trigger to export the rows from the custom db but my code doesn't work >>> client bindKey("F2", "down", function () if guiSetVisible ( wndPVList, false ) then guiSetVisible ( wndPVList, true ) triggerServerEvent("SelectRows", localPlayer) showCursor(true) else guiSetVisible ( wndPVList, false ) showCursor(false) end end ) server : addEvent("SelectRows",true) addEventHandler("SelectRows",getRootElement(), function() connect = dbConnect( "sqlite", "database.db" ) rows = dbExec(connect, "SELECT * FROM `VList` WHERE `account`=?",getAccountName(getPlayerAccount(source))) --- Client trigger .. to send [ rows ] and insert them into gridlist end ) Note : i want a way that i can insert this : - rows = dbExec(connect, "SELECT * FROM `VList` WHERE `account`=?",getAccountName(getPlayerAccount(source))) into a gridlist !!!
-
i'm getting this !!> ERROR: rolePlayLy-VehicleSystem\server.lua:11: attempt to concatenate global 'acc' (a boolean value)
-
i have problem in this code acc = getPlayerAccount(source) connection = dbConnect( "sqlite", "database.db" ) dbExec( connection, "INSERT INTO VList VALUES(account,id,name,price)", "ss",22,"sso",9876782) > i want to insert into [ VList ] table a row's that include [ acc ] that is a Player account how i can do that?
-
i'm sorry but can you explain for me more i don't get it >?
-
i'm done can anyone help me ?
-
anyone !help?
-
Hi Guy's i have been maken a mounted minigun Script and i have few problems with it first problem is when i command to create the minigun and attach it to the Player the rotations of the Elements { Player , Weapon } are not Match's i mean by that the Weapon not In front of the Player < a Screen Shot of the Problem The second Problem is I want the Weapon to move up & down for aiming i made it move but !! the problem is the weapon and the player are Attached Of course but if there a way to move the weapon only up and down ScreenShot : setElementFrozen(localPlayer,false) local x,y,z = getElementPosition(localPlayer) local gunCol = createColSphere ( x, y, z, 2 ) local vehicle = getPedOccupiedVehicle (localPlayer) local x2,y2,z2 = getElementPosition(vehicle) local screenW,screenH = guiGetScreenSize() local weapon function attach ( ) local detection = isElementWithinColShape ( localPlayer, gunCol ) if detection then weapon = createWeapon("minigun", x2, y2, z2+2) attachElements ( weapon, vehicle, 0, -1.5, 0.7,0,0,180 ) setWeaponClipAmmo(weapon, 99999) -- setWeaponState(weapon, "firing") setWeaponProperty(weapon, "fire_rotation", 0, -30, 0) --setElementPosition ( localPlayer, x2, y2-1.5, z2+2 ) attachElements ( localPlayer, weapon, 0, 0, 0 ) setElementFrozen(localPlayer,true) toggleAllControls(localPlayer,false) setElementData(localPlayer,"firedoska",true) setPedRotation(localPlayer,90 ) setPedAnimation( localPlayer, "WEAPONS", "SHP_Tray_Pose",0,false) setWeaponOwner(weapon,localPlayer) end end addCommandHandler ( "attach", attach ) local aimSensitivity = 330; function rotateGun_Handler(cX, cY, aX, aY, wX, wY, wZ) local oX, oY, oZ, oRX, oRY, oRZ = getElementAttachedOffsets(weapon); if (oRX-((cY-0.5)*aimSensitivity) > 45 or oRX-((cY-0.5)*aimSensitivity) < 30) then -- Pitch Restriction oRX = oRX-((cY-0.5)*aimSensitivity); end if (oRZ-((cX-0.5)*aimSensitivity) > 30 or oRZ-((cX-0.5)*aimSensitivity) < 50) then -- Yaw Restriction oRZ = oRZ-((cX-0.5)*aimSensitivity); end setCameraTarget(localPlayer,localPlayer) setElementAttachedOffsets(weapon, oX, oY, oZ, oRX, oRY, oRZ); setCursorPosition(screenW/2, screenH/2); end addEventHandler( "onClientCursorMove", getRootElement( ), rotateGun_Handler) function pedrot() local _,_,rZ = getElementRotation(weapon) setElementRotation(localPlayer, 0, 0, rZ) end addEventHandler("onClientRender", getRootElement(),pedrot) function fireme() if getElementData(localPlayer,"firedoska") == true then if getWeaponState(weapon) == "ready" then fireWeapon(weapon) else return end end end bindKey("mouse1", "down",fireme) function unaat() detachElements (localPlayer, weapon) removeEventHandler( "onClientCursorMove", getRootElement( ), rotateGun_Handler) removeEventHandler("onClientRender", getRootElement(),pedrot) destroyElement(weapon) end bindKey("k", "down",unaat) setTimer(function() if getElementData(localPlayer,"firedoska") == true then addEventHandler( "onClientCursorMove", getRootElement( ), rotateGun_Handler) addEventHandler("onClientRender", getRootElement(),pedrot) end end,1000,0) i well be grateful for help Thanks all,
-
Please Guys Almost Done With this script Help Me to Attach the weapon and player with the same rotation because i tried attachElements ( localPlayer,weapon, 0, -1.5, 0.7 , rx,ry,180) ---Here at RZ but the rotation not 180 and not the same rotation with the attached elements
-
i just now need the weapon to be Completely in front of the ped
-
same problem ! what changes you have made to the script !? sorry for bumping
-
GTX thanks man, the aiming now works 100% but it seem that the rotation of the ped and weapon different i want the weapon to be Completely in front of the ped And thanks Very very much
-
ok man but how about rotate the gun ?~ i mean i need the gun to move around and aim like the one on the video i tried very hard and i made this local x,y,z = getElementPosition(localPlayer) local gunCol = createColSphere ( x, y, z, 2 ) local vehicle = getPedOccupiedVehicle (localPlayer) local x2,y2,z2 = getElementPosition(vehicle) local screenW,screenH = guiGetScreenSize() local weapon function attach ( ) local detection = isElementWithinColShape ( localPlayer, gunCol ) if detection then weapon = createWeapon("minigun", x2, y2, z2+2) attachElements ( weapon, vehicle, 0, -1.5, 0.7 ) setWeaponClipAmmo(weapon, 99999) -- setWeaponState(weapon, "firing") setWeaponProperty(weapon, "fire_rotation", 0, -30, 0) --setElementPosition ( localPlayer, x2, y2-1.5, z2+2 ) attachElements ( localPlayer, weapon, 0, 0, 0 ) setElementRotation(weapon,0,0,180) setPedRotation(localPlayer,90 ) setPedAnimation( localPlayer, "WEAPONS", "SHP_Tray_Pose",0,false) setWeaponOwner(weapon,localPlayer) end end addCommandHandler ( "attach", attach ) local aimSensitivity = 30; function rotateGun_Handler(cX, cY, aX, aY, wX, wY, wZ) local oX, oY, oZ, oRX, oRY, oRZ = getElementAttachedOffsets(weapon); --if (oRX-((cY-0.5)*aimSensitivity) > 45 or oRX-((cY-0.5)*aimSensitivity) < 30) then -- Pitch Restriction --oRX = oRX-((cY-0.5)*aimSensitivity); --end if (oRZ-((cX-0.5)*aimSensitivity) > 30 or oRZ-((cX-0.5)*aimSensitivity) < 50) then -- Yaw Restriction oRZ = oRZ-((cX-0.5)*aimSensitivity); end setCameraTarget(localPlayer,localPlayer) setElementAttachedOffsets(weapon, oX, oY, oZ, oRX, oRY, oRZ); setCursorPosition(screenW/2, screenH/2); end addEventHandler( "onClientCursorMove", getRootElement( ), rotateGun_Handler) addEventHandler("onClientRender", root, function() local _,_,rZ = getElementRotation(weapon) setElementRotation(localPlayer, 0, 0, rZ-10) end ) function fireme() setTimer(function() if getWeaponState(weapon) == "ready" then setWeaponState(weapon, "firing") else return end end,1000,0) end bindKey("mouse1", "down",fireme) the problem in the code i posted is that when ped mount the gun the gun rotate so slow and the gun not match with the ped in rotation ! please anybody help me
-
Hi Guys, I Want to create Mounted Minigun like the one on this video So Please I need some Help somebody give me functions i well be grateful Tnx
-
you need to now that what trying to do is trigger { id, Price} for weapon and maybe contain {Ammo} from The Client Side that contain { Table And Gridlist } well, What you Gone do is Client Side First :- Create Table and insert { ID , Price , AMMO } like This Weapons = { {ID,Price,AMMO} } Example Weapons = { {32,"Name",100,9999} } after The Table Created Now you need to Create Gridlist Then insert The Table in the Gridlist and Create Button for Triggering server function btnbuy = guiCreateButton(773, 596, 127, 41, "buyWep", false) gridlist = guiCreateGridList(412, 179, 488, 412, false) guiGridListAddColumn(gridlist, "#", 0.2) guiGridListAddColumn(gridlist, "Name", 0.2) guiGridListAddColumn(gridlist, "Price", 0.2) guiGridListAddColumn(gridlist, "AMMO", 0.2) for k,v in ipairs ( Weapons ) do local row = guiGridListAddRow (gridlist) guiGridListSetItemText (gridlist, row, 1,v [1] , false, false) guiGridListSetItemText (gridlist, row, 2, v [2], false, false) guiGridListSetItemText (gridlist, row, 3, v [3] , false, false) guiGridListSetItemText (gridlist, row, 4, v [4] , false, false) end function buygun() if (source == btnbuy) then if (guiGridListGetSelectedItem (gridlist)) then local weapID = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 1) local weapName = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 2) local weapPrice = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 3) local weapAMMO = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 4) triggerServerEvent ("buyweapon", getLocalPlayer(), weapID, weapName, weapPrice, weapAMMO) end end end addEventHandler ("onClientGUIClick", getRootElement(), buygun) Server Side :- addEvent ("createweap", true) addEventHandler ("buyweapon", getRootElement(), function(weapID, weapName, weapPrice, weapAMMO) if (getPlayerMoney (source) >= tonumber(weapPrice)) then takePlayerMoney (source, tonumber (weapPrice)) giveWeapon(source,weapID,weapAMMO) else outputChatBox ("Have No Cash!", source, 255, 0, 0, false) end end ) i Hope you get the idea for more information about the tables and gridlist viewtopic.php?f=148&t=87781
-
NemoxHero, The idea of the transport script is store an x,y,z for every position you want to travel like this, client side : Buslocations = { {"Las Venturas","LV","100$",x,y,z}, ------- Edit [ X, y, z ] to Las Venturas position {"Los Santos","LS","100$",x,y,z},------- Edit [ X, y, z ] to Los Santo position {"San Fierro","SF","100$",x,y,z} ------- Edit [ X, y, z ] to San Fierro position } --------------------------- ---- Here put gui elements --------------------------- for k,v in ipairs (Buslocations) do local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1,v[1], false, false) guiGridListSetItemText(grid, row, 2,v[2], false, false) guiGridListSetItemText(grid, row, 3,v[3], false, false) guiGridListSetItemText(grid, row, 4,v[4], false, false) guiGridListSetItemText(grid, row, 5,v[5], false, false) guiGridListSetItemText(grid, row, 6,v[6], false, false) end createMarker = (.......yourcode.....) ------------------------------------------------------------------------- ---------- or maybe you can use table to create a markers by one function ---------- and function for showing element of the gui on marker hit ------------------------------------------------------------------------- addEventHandler("onClientGUIClick",root, function () if (source == reject) then guiSetVisible(window, false) showCursor(false) elseif (source == spawn) then guiSetVisible(window,false) showCursor(false) local cityname = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 1) local price = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 3) local x = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 4) local y = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 5) local z = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 6) triggerServerEvent("warpplayer",localPlayer, cityname,price,x,y,z) end end) * : Note : You need to add new raw's to gridlist to contain the [x,y,z] server side addEvent ("warpplayer",true) addEventHandler ("warpplayer",getRootElement(), function (cityname,price,x,y,z) if getElementZoneName (source) == cityname then if ( getPlayerMoney ( source ) < 100 ) then outputChatBox("You need 100$ to Travel.", source, 255,0,0) else spawnPlayer(client, x,y,z,46, 250, 0) end end end )
-
Any Help Guys ?!