Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. playerSource it's not defined in your code replace it with client.
  2. Do you mean 'exporting OOP classes with functions ' if yes as far as i know It's not possible.
  3. Walid

    projectile script

    Yeh i know sorry bro i didn't see your code .
  4. Walid

    projectile script

    local antiSpamAds = {} function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then if getElementModel(vehicle) == 497 then if isTimer(antiSpamAds[localPlayer]) then return end local x,y,z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z) antiSpamAds[localPlayer] = setTimer(function() end, 4000, 1) end end end bindKey("lalt", "down", shootProjectile) bindKey("ralt", "down", shootProjectile)
  5. Walid

    projectile script

    Why he need to use addCommanHandler() , he already use bindKey Example: function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) if getElementModel(vehicle) == 497 then local x,y,z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z) end end bindKey("lalt", "down", shootProjectile) bindKey("ralt", "down", shootProjectile)
  6. Walid

    projectile script

    i think you don't need setTimer here.
  7. Walid

    projectile script

    Replace source with vehicle here:
  8. @TAPL it's just an example he can do the same thing attacker team will be Army , and source team will be SWAT
  9. yes it's , just check player team onClientPlayerDamage () example: addEventHandler("onClientPlayerDamage", localPlayer, function(attacker) if (attacker and getElementType(attacker) == "player" and attacker ~= source) then if (getTeamName(getPlayerTeam(attacker)) == "SWAT") and (getTeamName(getPlayerTeam(source)) == "Army") then cancelEvent() end end end )
  10. Walid

    Turf zone leaving

    where should I add that? You need to use onColShapeLeave()
  11. try to do it by yourself and post your code here and we will help you.
  12. i think triggerServerEvent is engouh , for more maybe you can use triggerLatentServerEvent this function is the same as triggerServerEvent except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred.
  13. they already gave you what you want here
  14. Simply you can use something like that : * Connect local driftdb = "drift.db" local connection = dbConnect("sqlite", driftdb) function drift() dbExec(connection, "CREATE TABLE IF NOT EXISTS drift (account TEXT, data TINYTEXT)") end addEventHandler("onResourceStart", resourceRoot,drift) *checking if exist row function doesAccountExistInDriftList(account) local check = dbPoll(dbQuery(connection, "SELECT * FROM drift WHERE account = ?",tostring(account)), -1) if type(check) == "table" and #check == 0 or not check then return false else return true end end * insert new row (account) function addNewAccount(account,drift) local check = dbPoll(dbQuery(connection, "SELECT * FROM drift WHERE account = ?",tostring(account)), -1) if type(check) == "table" and #check == 0 or not check then dbExec(connection, "INSERT INTO drift VALUES (?, ?)",tostring(account), tonumber(drift),1) return true else return false end end *update drift points function updateDriftPoints(account,drift) local check = dbPoll(dbQuery(connection, "SELECT * FROM drift WHERE account = ?",tostring(account)), -1) if type(check) ~= "table" or #check ~= 0 or check then if dbExec(connection, "UPDATE drift SET data = ? WHERE account = ?",tonumber(drift),tostring(account)) then return true else return false end end end just check if the account name exist using "doesAccountExistInDriftList()" if yes update drift points using "updateDriftPoints()" function if no insert new row using "addNewAccount(). Note: in this case it will just save the last points so if you want to add them to the old points without replacing the old points with new points , you need to check the player current points before you call updateDriftPoints() function.
  15. You must you use getVehicleNitroLevel() local nitro = getVehicleNitroLevel(vehicle) like this : local id = 8 local slot = getVehicleUpgradeOnSlot(vehicle, tonumber(id)) if slot then if nitro ~= false and nitro ~= nil and nitro > 0 then -- Your Dx code using this one ("Nitro: "..math.floor(nitro/1*100).." %" ) end end
  16. why he need to use veh1 , veh2 hhh it can be like this dbQuery(db, "CREATE TABLE IF NOT EXISTS vehs (vehicle TEXT, x INTERGER, y INTEGER, z INTEGER) Print : 1. vehicle , x , y , z 2. vehicle2 , x , y , z 3. vehicle3 , x , y , z etc ...
  17. I think you must read the first post he is asking about :
  18. Try to attach ' ColSphere' createColSphere() to the pickup then use onColShipHit. more than that garage it's not defined here : setElementData(garage, "pickup", pickup)
  19. [quote name=..&G:..]Still nothing.. -- add ouputChatBox to this part and tell me if you can see the msg or not function pickupShowGarageGUI(thePlayer) outputChatBox("Working fine",thePlayer) triggerClientEvent ( thePlayer, "showGarageUI", thePlayer ) end
  20. it must be like this : if isPlayerInVehicle ( thePlayer ) then return end Edit : sorry didn't see WhoAmI post.
  21. Try this : function pickupShowGarageGUI(thePlayer) if ( source ~= pickup ) then return end triggerClientEvent ( thePlayer, "showGarageUI", thePlayer ) end function spawnGaragesOnStart( res ) local result = mysqli:query("SELECT x, y, z, interior, dimension FROM garages") while true do local row = mysqli:fetch_assoc(result) if not (row) then break end local x = row['x'] local y = row['y'] local z = row['z'] local int = row['interior'] local dim = row['dimension'] pickup = createPickup ( x+4.40, y+4, z-1, 3, 1277, 0, 0 ) setElementData(garage, "pickup", pickup) setElementInterior(pickup, tonumber(int)) setElementDimension(pickup, tonumber(dim)) addEventHandler ( "onPickupHit", pickup, pickupShowGarageGUI ) end mysqli:free_result(result) end addEventHandler("onResourceStart", resourceRoot, spawnGaragesOnStart)
×
×
  • Create New...