Jump to content

Agon

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by Agon

  1. Agon

    unexpected symbols

    oh you mean it will make me visible again when i type /hide without putting setElementAlpha(source,255) and setPlayerNametagShowing(source,true) in the script?
  2. Agon

    unexpected symbols

    Oh i see my fault thank you. is it because I'm trying to make a script that makes admins, supmods, and mods invisible?
  3. Hi this is my code and it says in line 3 there is an unexpected symbol near "if". i tried removing "(" and ")" but it said: ")" expected near "=".. what's wrong with that? function hideMe(source) local account = getAccountName(getPlayerAccount(source)) if (getElementAlpha(source) == 255) and if (isPlayerNametagShowing(source)) then if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) elseif isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then setPlayerNametagShowing(source, false) setElementAlpha(source, 0) else outputChatBox("You are not allowed to use this command!", source, 255, 0, 0) end else setElementAlpha(source, 255) setPlayerNametagShowing(source, true) end addCommandHandler("hide", getRootElement(), hideMe)
  4. Agon

    Gravity Problem

    any wiki function that checks if vehicle is touching somewhere or something?
  5. Agon

    Gravity Problem

    I know that resources but they make me fly wall to wall and sometimes to sky... and that's annoying. i want to make it with checking if vehicle is touching a wall or something else. if it doesn't touch (i mean if it is on the air), it won't perform gravity change.. hope you understand me
  6. Agon

    Gravity Problem

    <meta> <info author="Agon" type="script" version="1.0" name="mygrav" description="change gravity"/> <script src="script.lua" type="client"/> </meta>
  7. Agon

    Gravity Problem

    i used /debugscript 3 but i didn't get any error and i can't drive on walls btw your second script may be good but i want to check if the vehicle's wheels on the ground. i saw some resources which didn't check that and it makes you fly sometimes...
  8. Agon

    Gravity Problem

    function playerOptions() setPedCanBeKnockedOffBike(source,false) addEventHandler("onClientPlayerVehicleEnter",source,enableGravityWheels) addEventHandler("onClientPlayerVehicleExit",source,disableGravityWheels) end function checkCarWheels() if isVehicleOnGround(car) == true then changeGravity() else return end end function changeGravity() setVehicleGravity(car,underx - x,undery - y,underz - z) end function disableGravityWheels() setVehicleGravity(car, 0, 0, -1) end function enableGravityWheels() local car = getPedOccupiedVehicle(source) local x,y,z = getElementPosition(car) local underX,underY,underZ = getVehicleUnderGravity(car) if (isVehicleOnGround(car) == false) and if (isPedInVehicle(source) == false) then return end else setTimer(checkCarWheels, 1000, 0) end end function getVehicleUnderGravity(element) local matrix = getElementMatrix (element) local offX = 0 * matrix[1][1] + 0 * matrix[2][1] - 1 * matrix[3][1] + matrix[4][1] local offY = 0 * matrix[1][2] + 0 * matrix[2][2] - 1 * matrix[3][2] + matrix[4][2] local offZ = 0 * matrix[1][3] + 0 * matrix[2][3] - 1 * matrix[3][3] + matrix[4][3] return offX,offY,offZ end addCommandHandler("gravity",enableGravityWheels) addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),playerOptions) I wanted to make a gravity script (with some help of resources) i can enable it (but doesn't work ) but don't know how to disable it again. should i use "addCommandHandler("gravity",disableGravityWheels)" ?
  9. Agon

    wierd error

    /run name = createVehicle(411, 0, 0, 6) --- you can change "name" you should give a name your function...
  10. I think there is no function that helps you about question 1. but you can use isElementWithinMarker you can create marker on your pickup and check if player standing on it...
  11. Agon

    Rank System

    function setMyRank ( thePlayer, theKiller ) local account = getAccountName(getPlayerAccount( theKiller )) local money = getPlayerMoney( theKiller) if isPedBot( thePlayer ) and if account and if not isGuestAccount then givePlayerMoney( theKiller, 5) setAccountData( myAccount, "theMoney", money) end end addEventHandler ( "onPlayerDamage", getRootElement(), setMyRank ) function chatbox(text, msgtype) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local myData = getAccountData( myAccount, "theMoney" ) if (msgtype == 0) then if money > 50 then outputChatBox("[Newbie]" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [Newbie] " .. name .. ": " .. text) elseif money > 500 then cancelEvent(true) outputChatBox("[Amateur]" .. name ..":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [Amateur] " .. name .. ": " .. text) elseif money > 5000 then cancelEvent(true) outputChatBox("[Pro]" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [Pro] " .. name .. ": " .. text) else outputChatBox("#FFFF00".. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end elseif (msgtype == 2) then end end addEventHandler("onPlayerChat", root, chatbox) I made this but is there another way of doing this? because players can get money from stunting but i want them to get money from killing zombies. Off Topic: btw is there anything that saves skins, moneys, weapons in something like MySQL? because i have been home servering and i can't use MySQL. [You know some servers have MySQL when something happen to their server (like powercut), players' data won't get lost, but when i close my server, all players' data get lost]
  12. function repairVeh( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) ----i don't know what max health is so i made it 1000 setElementHealth(theVehicle,1000) takePlayerMoney(500) end addCommandHandler("repair",repairVeh) function addNitro( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) addVehicleUpgrade(theVehicle, 1010) takePlayerMoney(500) end addCommandHandler("nitro",addNitro) Better, lol. | | | \/
  13. I made this so far with some help of the wiki: <catalog type="weapons"> <group name="Melee"> <weapon id="5" price="25" level="1" name="Baseball bat" /> <weapon id="9" price="250" level="1" name="Chainsaw" /> <weapon id="8" price="150" level="1" name="Katana" /> <weapon id="4" price="30" level="1" name="Knife" /> <weapon id="6" price="10" level="1" name="Shovel" /> </group> <group name="Handguns"> <weapon id="24" price="350" level="3" name="Desert eagle" /> <weapon id="22" price="300" level="1" name="Pistol" /> <weapon id="23" price="250" level="1" name="Silenced" /> </group> <group name="Shotguns"> <weapon id="26" price="850" level="4" name="Sawn-off shotgun" /> <weapon id="25" price="700" level="6" name="Shotgun" /> <weapon id="27" price="550" level="6" name="SPAZ-12" /> </group> <group name="Sub-machine guns"> <weapon id="29" price="500" level="9" name="MP5" /> <weapon id="32" price="700" level="12" name="TEC-9" /> <weapon id="28" price="850" level="12" name="Uzi" /> </group> <group name="Machine guns"> <weapon id="30" price="1500" level="15" name="AK47" /> <weapon id="31" price="1250" level="15" name="M4" /> </group> <group name="Rifles"> <weapon id="33" price="2000" level="20" name="Country sniper" /> <weapon id="34" price="3000" level="20" name="Sniper" /> </group> </catalog> ---Serverside addEvent( "hitTheMarker", true ) buyGun_Window = { } weaponList_Grid = { } weaponAccept_Button = { } weaponCancel_Button = { } function gunWindow( ) buyGun_Window = guiCreateWindow( 374,104,346,519,"Select Your Weapon",false ) guiWindowSetSizable( buyGun_Window,false ) weaponList_Grid = guiCreateGridList( 11,31,324,435,false,buyGun_Window ) guiGridListSetSelectionMode( weaponList_Grid,2 ) weaponAccept_Button = guiCreateButton( 12,477,118,33,"Accept",false,buyGun_Window ) weaponCancel_Button = guiCreateButton( 213,477,118,31,"Cancel",false,buyGun_Window ) showCursor(true, true) local id = guiGridListAddColumn( playerList, "ID", 0.85 ) local price = guiGridListAddColumn( playerList, "Price", 0.85 ) local level = guiGridListAddColumn( playerList, "Level", 0.85) local wname = guiGridListAddColumn( playerList, "Weapon name", 0.85 ) local file = xmlLoadFile ( "weapons.xml" ) weaponTable = {} if weapon then for _,group in ipairs(xmlNodeGetChildren(file)) do local row = guiGridListAddRow ( weaponList_Grid ) local name = xmlNodeGetAttribute(group,"type") weaponTable[name] = {} guiGridListSetItemText(weaponList_Grid,row,1,name,false,false) guiGridListSetItemData(weaponList_Grid,row,1,"header") for _,weapon in ipairs(xmlNodeGetChildren(group)) do local id = xmlNodeGetAttribute(weapon,"id") local price = xmlNodeGetAttribute(weapon,"price") local level = xmlNodeGetAttribute(weapon,"level") local wname = xmlNodeGetAttribute(weapon,"name") table.insert(weaponTable[name],{id,price,level,wname}) end end setElementData(weaponList_Grid,"expanded","none") xmlUnloadFile ( file ) end addEventHandler( "hitTheMarker", root, gunWindow ) function giveMeWeapon(weaponid) if weaponid then giveWeapon(source, weaponid, 500) end end addEvent("giveWeaponFromGUI",true) addEventHandler("giveWeaponFromGUI",root,giveMeWeapon) function processDoubleClick(button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(weaponList_Grid) if row and col and row ~= -1 and col ~= -1 then if guiGridListGetItemData(weaponList_Grid,row,col) == "header" then local selected = guiGridListGetItemText(weaponList_Grid,row,col) changeGridlistState(selected) end end end end function changeGridlistState(group) if group then if getElementData(weaponList_Grid,"expanded") == group then guiGridListClear(weaponList_Grid) for group,_ in pairs(weaponTable) do local row = guiGridListAddRow(weaponList_Grid) guiGridListSetItemText(weaponList_Grid,row,1,group,false,false) guiGridListSetItemData(weaponList_Grid,row,1,"header") end setElementData(weaponList_Grid,"expanded","none") else guiGridListClear(weaponList_Grid) local row = guiGridListAddRow(weaponList_Grid) guiGridListSetItemText(weaponList_Grid,row,1,group,false,false) guiGridListSetItemData(weaponList_Grid,row,1,"header") for _,weapon in ipairs(weaponTable[group]) do row = guiGridListAddRow(weaponList_Grid) guiGridListSetItemText(weaponList_Grid,row,1,"- "..weapon[2],false,false) guiGridListSetItemText(weaponList_Grid,row,2,getWeaponType(tonumber(weapon[1])),false,false) guiGridListSetItemData(weaponList_Grid,row,1,tostring(weapon[1])) end setElementData(weaponList_Grid,"expanded",group) end end end --- Clientside function giveMeWeaponHandler(button,state) if button == "left" and state == "up" then local row,col = guiGridListGetSelectedItem(weaponList_Grid) if row and col and row ~= -1 and col ~= -1 then local selected = guiGridListGetItemData(weaponList_Grid,row,col) selected = tonumber(selected) if selected then triggerServerEvent("giveWeaponFromGUI",getRootElement(),selected,x,y,z) guiSetVisible(buyGun_Window,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else outputChatBox("Please select a weapon.") end end end but it seems it doesn't work...
  14. i know that but list doesn't appear i tried everything but didn't work..
  15. everything is ok but weapons.xml doesn't appear tried them but list didn't appear
  16. Agon

    Scale player

    setObjectScale https://wiki.multitheftauto.com/wiki/SetObjectScale but it works with objects (elements). i don't know if you can use it on players..
  17. Thank you Solidsnake it works. but how can i add gridlist? i have weapons.xml but i don't know how to add the list into gui..
  18. still can't see the gui
  19. gui doesn't appear it still says " line 9 bad argument @ addEventHandler [expected element at argument 2, got nil] "
  20. Your server side doesn't create marker(i think it's my fault ) I made this but when i go to marker, gui doesn't appear ----Server Side function createMyMarker() local bankWeaponMarker=createMarker(2304.19921875, -16.19921875, 25.5, "cylinder", 1, 0, 0, 255, 255) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createMyMarker) function installEverything(hElement) triggerClientEvent ( hElement,"hitTheMarker" ,hElement) end addEventHandler("onMarkerHit", bankWeaponMarker, installEverything) it says " line 9 bad argument @ addEventHandler [expected element at argument 2, got nil] Clientside is same with yours..
  21. ---Server-side function installEverything() local bankWeaponMarker=createMarker(2304.19921875, -16.19921875, 25.5, "cylinder", 1, 0, 0, 255, 0) end addEvent("hitTheMarker", true) addEventHandler("hitTheMarker", getResourceRootElement(getThisResource)), installEverything) ---Client-side function gunWindow() triggerServerEvent ( "hitTheMarker", bankWeaponMarker, gunWindow ) buyGun_Window[1] = guiCreateWindow(374,104,346,519,"Select Your Weapon",false) guiWindowSetSizable(buyGun_Window[1],false) weaponList_Grid[1] = guiCreateGridList(11,31,324,435,false,buyGun_Window[1]) guiGridListSetSelectionMode(weaponList_Grid[1],2) weaponAccept_Button[1] = guiCreateButton(12,477,118,33,"Accept",false,buyGun_Window[1]) weaponCancel_Button[2] = guiCreateButton(213,477,118,31,"Cancel",false,buyGun_Window[1]) end addEventHandler("onMarkerHit", bankWeaponMarker, gunWindow) like this?
  22. Agon

    Wheels question

    Try replacing one by one. you will find correct wheel..
  23. Do i need to trigger events? because my markers will be server side but gui will be client side..
  24. Agon

    Wheels question

    GanJaRuleZ i think he means how to add different wheels like that.. You can use engineLoadDFF and engineReplaceModel https://wiki.multitheftauto.com/wiki/EngineLoadDFF https://wiki.multitheftauto.com/wiki/EngineReplaceModel
×
×
  • Create New...