Jump to content

-misterX-

Members
  • Posts

    78
  • Joined

  • Last visited

Details

  • Gang
    gusa

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

-misterX-'s Achievements

Transformer

Transformer (11/54)

0

Reputation

  1. the debug reports error to compare a boolean with a number line 147... any help? server function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) bx, by, color, scale, font = bx or ax, by or ay, color or tocolor(255,255,255,255), scale or 1, font or "default" if alignX then if alignX == "center" then ax = ax + (bx - ax - callClientFunction(source, "dxGetTextWidth", str:gsub("#%x%x%x%x%x%x",""), scale, font))/2 elseif alignX == "right" then ax = bx - callClientFunction(source, "dxGetTextWidth", str:gsub("#%x%x%x%x%x%x",""), scale, font) end end if alignY then if alignY == "center" then ay = ay + (by - ay - callClientFunction(source, "dxGetFontHeight", scale, font))/2 elseif alignY == "bottom" then ay = by - callClientFunction(source, "dxGetFontHeight", scale, font) end end local alpha = string.format("%08X", color):sub(1,2) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(getColorFromString("#"..col..alpha)) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(getColorFromString("#"..col..alpha)) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) callClientFunction(source, "dxDrawText", cap, ax, ay, ax + callClientFunction(source, "dxGetTextWidth", cap, scale, font ), by, color, scale, font ) end end addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i,player in ipairs (getElementsByType("player")) do setElementData(player,"showCar",false) end executeSQLQuery ( "CREATE TABLE IF NOT EXISTS cars (accountName TEXT, CarName TEXT, Health TEXT)" ) outputDebugString ( "Successfully connected to DataBase" ) local markers = getElementsByType ( "marker", getResourceRootElement() ) for theKey,theMarkers in ipairs(markers) do local x,y,z = getElementPosition( theMarkers ) createBlip ( x, y, z, 55, 0, 0, 0, 255 ) end end ) addEventHandler("onPlayerJoin",root, function() setElementData(source,"showCar",false) end) addEventHandler ( "onPlayerLogin", root, function ( _, account ) triggerEvent("UpdateCarLists",source,source) for index, cars in ipairs ( getAccountCars ( source ) ) do triggerClientEvent("updateCarListc",source,source,cars["CarName"],cars["Health"],index) end end ) function doesCarExist ( player,Car ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) local result = executeSQLQuery ( "SELECT * FROM cars WHERE accountName = ? AND CarName = ?", tostring ( accountName ), tostring ( Car ) ) if ( type ( result ) == "table" and #result == 0 or not result ) then return false, "This Car does not exists." else return true end end function addCarToDatabase ( player,Car ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) if ( doesCarExist ( player,Car ) ) then return false, "A Car with this name already exist." end if ( executeSQLQuery( "INSERT INTO `cars` (`accountName`, `CarName`, `Health`) VALUES ('".. tostring ( accountName ) .."', '".. tostring ( Car ) .."', '1000');" ) ) then else return false, "Unable to create Car." end end function setCarHealth ( player,Car,He ) local Health = math.ceil ( He ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) if ( not doesCarExist ( player,Car ) ) then return false, "This Car does not exists." end return executeSQLQuery( "UPDATE `cars` SET `Health` = '".. tostring (Health) .."' WHERE `accountName` = '" .. tostring ( accountName ) .."' AND CarName = '".. tostring ( Car ) .."'" ) end function removeCarFromDatabase ( player,Car ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) if ( not doesCarExist ( player,Car ) ) then return false, "A Car with this name already exist." end if ( executeSQLQuery("DELETE FROM `cars` WHERE `accountName` = '" .. tostring ( accountName ) .. "' AND CarName = '".. tostring ( Car ) .."'" ) ) then else return false, "Unable to create Car." end end function getAccountCars ( player ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) local result = executeSQLQuery ( "SELECT * FROM cars WHERE accountName = ?", tostring ( accountName ) ) if ( type ( result ) == "table" and #result == 0 or not result ) then return { } else return result end end function getCarHealth ( player,Car ) local account = getPlayerAccount ( player ) local accountName = getAccountName ( account ) local result = executeSQLQuery ( "SELECT * FROM cars WHERE accountName = ? AND CarName = ?", tostring ( accountName ), tostring ( Car ) ) if ( type ( result ) == "table" and #result == 0 or not result ) then return "None" else return result[ 1 ][ "Health" ] end end ---------- Tirger addEvent("BuyVc",true) addEventHandler("BuyVc",root, function (vcName,vcPrize) if not doesCarExist ( source,vcName ) then takePlayerMoney ( source, tonumber(vcPrize) ) addCarToDatabase(source,vcName) outputChatBox("تم شراء السيارة وتم حفظها = ".. getElementData(source,"bin"),source,0,255,0) for index, cars in ipairs ( getAccountCars ( source ) ) do triggerClientEvent("updateCarListc",source,source,cars["CarName"],cars["Health"],index) end else outputChatBox("لديك مثل هذه السيارة لا يمكنك الحصول على 2",source,255,0,0) end end ) addEvent("UpdateCarLists",true) addEventHandler("UpdateCarLists",root, function (player) if getElementData(player,"showCar") == true then local vch = getElementHealth ( getElementData(player,"Car") ) if vch < 300 then removeCarFromDatabase(player,getElementData(player,"CarName")) setElementData(player,"showCar",false) destroyElement(getElementData(player,"Car")) removeElementData(player,"Car") end if vch > 1000 then setCarHealth(player,vcName,1000) else setCarHealth(player,vcName,vch) end end for index, cars in ipairs ( getAccountCars ( player ) ) do triggerClientEvent("updateCarListc",player,player,cars["CarName"],cars["Health"],index) end end ) addEvent("useCar",true) addEventHandler("useCar",root, function (vcName,vcHealth) if getElementData(source,"showCar") == true then local vch = getElementHealth ( getElementData(source,"Car") ) if vch < 300 then removeCarFromDatabase(source,getElementData(source,"CarName")) setElementData(source,"showCar",false) destroyElement(getElementData(source,"Car")) removeElementData(source,"Car") end destroyElement(getElementData(source,"Car")) end local x, y, z = getElementPosition ( source ) local vc = createVehicle ( getVehicleModelFromName ( vcName ), x + 1, y, z + 1 ) setElementData(vc,"CarF1",true) setElementData(vc,"CarF1Player",source) setElementHealth ( vc, getCarHealth(source,vcName) ) setElementData(source,"Car",vc) setElementData(source,"showCar",true) setElementData(source,"CarName",vcName) outputChatBox("تم اظهار سيارتك",source,0,255,0) end ) addEvent("lockCar",true) addEventHandler("lockCar",root, function (vcName) if getElementData(source,"showCar") == true then if getElementData(source,"CarName") == vcName then if isVehicleLocked ( getElementData(source,"Car") ) then setVehicleLocked ( getElementData(source,"Car"), false ) outputChatBox("نم فتح قفل سيارتك",source,0,255,0) else setVehicleLocked ( getElementData(source,"Car"), true ) outputChatBox("تم قفل سيارتك",source,255,0,0) end end end end ) addEvent("DestroyCar",true) addEventHandler("DestroyCar",root, function (vcName) if getElementData(source,"showCar") == true then if getElementData(source,"CarName") == vcName then local vch = getElementHealth ( getElementData(source,"Car") ) if vch < 300 then removeCarFromDatabase(source,getElementData(source,"CarName")) setElementData(source,"showCar",false) destroyElement(getElementData(source,"Car")) removeElementData(source,"Car") end if vch > 1000 then setCarHealth(source,vcName,1000) else setCarHealth(source,vcName,vch) end destroyElement(getElementData(source,"Car")) setElementData(source,"showCar",false) else outputChatBox("هذه ليست السيارة التي اظهرتها",source,255,0,0) end else outputChatBox("انت لم تستخدم سيارة !!",source,255,0,0) end end ) function VehicleLoss(loss) if (getElementData(source,"CarF1") == true) then local vch = getElementHealth ( source ) if vch < 300 then removeCarFromDatabase(getElementData(source,"CarF1Player"),getVehicleName ( source )) setElementData(getElementData(source,"CarF1Player"),"showCar",false) destroyElement(source) removeElementData(getElementData(source,"CarF1Player"),"Car") removeElementData(source,"CarF1Player") setElementData(source,"CarF1",false) end setCarHealth(getElementData(source,"CarF1Player"),getVehicleName ( source ),vch-loss) end end addEventHandler("onVehicleDamage", getRootElement(), VehicleLoss) addEvent("onPlayerGarageEnter", true) addEventHandler("onResourceStart", getResourceRootElement(), function (resource) for i=0,49 do
  2. well i think so as well, my question is how do i make that!
  3. how do i make zombies spawn from a spawnpoint?
  4. i still don't understand..
  5. i don't understand what you mean
  6. how do i meake them see?
  7. when i enter the car other players doesn't see the weapons and when i shot to someone i have no effect addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 411 then local x, y, z = getElementPosition ( theVehicle ) local rx, ry, rz = getElementRotation ( theVehicle ) minigunOne = createWeapon ( "minigun", x, y, z ) minigunTwo = createWeapon ("minigun", x, y, z ) minigunOneF = createWeapon ( "minigun", x, y, z ) minigunTwoF = createWeapon ("minigun", x, y, z ) setElementAlpha ( minigunOne,0) setElementAlpha ( minigunTwo,0) attachElements ( minigunOne, theVehicle, 0.7, 1, -0.1, 0, 0, 93) attachElements ( minigunTwo, theVehicle, 0.55, 1, -0.1, 0, 0, 93 ) attachElements ( minigunOneF, theVehicle, 0.7, 1, 0.50, 0, 30, 93) attachElements ( minigunTwoF, theVehicle, 0.55, 1, 0.50, 0, 30, 93 ) bindKey ( "mouse1", "down", enableFire ) bindKey ( "mouse1", "up", disableFire ) end end ) addEventHandler("onClientVehicleExit", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 411 then if minigunOne and minigunTwo then destroyElement (minigunOne) destroyElement (minigunTwo) destroyElement (minigunOneF) destroyElement (minigunTwoF) unbindKey ( "mouse1", "down", enableFire ) unbindKey ( "mouse1", "up", disableFire ) end end end ) function enableFire() if isTimer(MGtimer) and isTimer(MG2timer) and minigunOne and minigunTwo then killTimer(MGimer) killTimer(MG2imer) else MGimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) MG2imer = setTimer(function() setWeaponState ( minigunTwo, "firing" ) end, 50, 1) -- MiniSound = playSound ( "Pro_Minigun.wav",true) -- setSoundVolume(MiniSound, 0.4) --setSoundEffectEnabled(MiniSound,"gargle",true) --setSoundSpeed ( MiniSound, 0.9 ) end end addEventHandler("onClientPlayerWasted", getLocalPlayer(), function() if minigunOne and minigunTwo then destroyElement (minigunOne) destroyElement (minigunTwo) unbindKey ( "mouse1", "down", enableFire ) unbindKey ( "mouse1", "up", disableFire ) end end ) function disableFire() if isTimer(MGtimer) and isTimer(MG2timer) and minigunOne and minigunTwo then killTimer(MGimer) killTimer(MG2imer) else MGimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) MG2imer = setTimer(function() setWeaponState ( minigunTwo, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end fileDelete("infernus.lua")
  8. -misterX-

    swatrope

    what doesnt work ? the debug just say bad argument in "isPlayerInVehicle" CMD_SWATROPE = "swatrope" function createSwatRope(player) if isPedInVehicle(player) then local myVehicle = getPedOccupiedVehicle(player) if getVehicleName(myVehicle) == "Police Maverick" then local x,y,z = getElementPosition(myVehicle) createSWATRope(x, y, z, 10000) else outputChatBox("Enter Police Maverick!", player, 255, 0, 0) end else outputChatBox("Enter Police Maverick!", player, 255, 0, 0) end end addCommandHandler(CMD_SWATROPE, createSwatRope)
  9. if in a function i attach a blip to a player how do i remove it when the player is wasted?
  10. not useful but thanks anyway
  11. @solidsnake14 how could i do what you said?
×
×
  • Create New...