Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. use the same method every time.
  2. Try this i already tried it it's working fine without typing t/admin function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end function setMyClassTo (player) if not isElement(player) then return end local class = "Admin" setElementData(player,"class",tostring(class)) end addCommandHandler("admin",setMyClassTo) Note: your class must be different to Admin
  3. Try this type T/admin in chatBox then try to enter the vehicle function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end
  4. bro try this and tell me what you can see in chatbox. function checkClass(player) if not isElement(player) then return end local class = getElementData(player,"class") if class then outputChatBox("You current calss is : "..class,player,255,0,0) end end addCommandHandler("class",checkClass)
  5. Try this function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) addEventHandler("onVehicleStartEnter", c1, onEnter) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if not isPlayerAdmin(thePlayer) then outputChatBox("This Vehicle Is Locked for the Class:Admin", thePlayer, 0, 255, 0) cancelEvent() end end function isPlayerAdmin(plr) if not isElement(plr) then return end if (getElementData(plr,"class") == "Admin") then return true else return false end end
  6. you can do the same thing just change skins with getElementData.
  7. dbExec(db, "UPDATE table(json) SET value = ? WHERE yourData = ?", json) maybe you did something wrong that's why i asked you to show me your code.
  8. Do you know how to/fromJSON work's ? when i send that data in THE SAME json will OVERRITE old data! and keep only the last one. Man you are inserting new values every time did you tired : dbExec(db, "UPDATE table(json) SET value = ? WHERE yourData = ?", json)
  9. Walid

    -3 Letters-

    Project Information Document OOP
  10. Walid

    -3 Letters-

    Strong Name Key GIS
  11. function convertMoney(plr, cmd, usd, gbp, amount) if plr and isElement(plr) then if not (tostring(usd)) or not(tostring(gbp)) then outputChatBox("[Wrong Command]: /currency usd gbp ", plr, 0, 255, 0) return end if (not tonumber(amount)) then return end exchangerate(plr,usd,gbp,amount) end end addCommandHandler("currency", convertMoney) function currency_return(sum) if sum ~= "ERROR" then outputChatBox(sum) end end function exchangerate(player,usd,gbp,amount) if (usd and gbp and amount) then return callRemote("<< you php file link >>", currency_return, player, usd,gbp,amount) end end untested Note: as ALw7sH said you must use fetchRemote to get echo (print text) or try to change you php file code.
  12. you don't need to check the vehicle model it can be like this if source == c1 then we know all that the source of this event (onVehicleStartEnter) is the vehicle in which a player began to enter.
  13. Walid

    SOLVED

    Yes i can see but he still asking for help read his last post
  14. Walid

    SOLVED

    local skins = {[125]=true,[285]=true} function cars () c1 = createVehicle ( 520, -2891.84765625, 460.4560546875, 4.9140625, 0, 0, 90 ) end addEventHandler ( "onResourceStart", resourceRoot, cars ) function onEnter(thePlayer) if thePlayer and isElement(thePlayer) and getElementType(therPlayer) == "player" then if source == c1 then local model = getElementModel(thePlayer) if not (skins[model]) then outputChatBox("This Vehicle Is Locked for The Soprano Vipers", thePlayer, 0, 255, 0) cancelEvent() end end end end addEventHandler("onVehicleStartEnter", getRootElement(), onEnter)
  15. Done local cmd = {} function gay(thePlayer) if getAccountName(getPlayerAccount(thePlayer)) == "swatrat" then if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then if not isTimer(cmd[thePlayer]) then local name = getPlayerName( thePlayer ) outputChatBox (tostring( name )..": #FF00FFHA GAY", root, 255, 255, 255, true ) cmd[thePlayer] = setTimer(resetcmd,30000,1,thePlayer) triggerClientEvent(root, "gay", root) else if isTimer(cmd[thePlayer]) then local remaining,execute = getTimerDetails(cmd[thePlayer]) outputChatBox("#FF0000[CMD] #ffffffWait "..math.floor(remaining/1000).." seconds.",thePlayer,255,255,255,true) end end end end end addCommandHandler("gay", gay) function resetcmd(thePlayer) if isTimer(cmd[thePlayer]) then killTimer(cmd[thePlayer]) end cmd[thePlayer] = nil end Edit : Sorry didn't see ALw7sH post
  16. what are you talking about try to explane your problem better or just post some screenshots.
  17. Try to PM MrBrutus as far as i know he is the owner.
  18. Yeh i just gave him something very simple : * Save local r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 = getVehicleColor( veh, true ) local color = toJSON({r1,g1,b1, r2,g2,b2, r3,g3,b3, r4,g4,b4}) *load local r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 = unpack( fromJSON( color )) setVehicleColor( veh, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 )
  19. it's not correct , what can he do if the player have more than two cars they will have the same color because you stored the vehicle color in an account. simply in this case try to use Sqilte and As @WhoAmI said before resource stops, get all vehicles and save it. After resource starts, load them. Example: -- Save -- You can use something like this local r1, g1, b1, r2, g2, b2 = getVehicleColor(theVehicle, true) local color = r1..","..g1..","..b1..","..r2..","..g2..","..b2 -- Sqlite part here -- Load local colorTable = -- From Sqlite local color = split(colorTable, ',') r1 = color[1] g1 = color[2] b1 = color[3] r2 = color[4] g2 = color[5] b2 = color[6]
  20. playerSource it's not defined in your code replace it with client.
  21. Do you mean 'exporting OOP classes with functions ' if yes as far as i know It's not possible.
  22. Walid

    projectile script

    Yeh i know sorry bro i didn't see your code .
×
×
  • Create New...