Jump to content

SheriFF

Members
  • Posts

    90
  • Joined

  • Last visited

Everything posted by SheriFF

  1. I love the 3d moddeling apps UI style.The corner-to-corner(or vertex) object placement is an awesome idea but can it be made to be precise(no gaps between objects)? EDIT: If not already implemented, a favorites category in object selector(which you can ofc edit) would be awesome. Dope project by the way, seems very helpful and easy-to-use
  2. Spune-mi ce va fi unic/original pe serverul tau, te rog, sau folosesti si tu un gm leaked? Off-topic : pe care*
  3. Am să fiu de-acord cu 'colegii' mei.Dacă nu ai idee cu ce se mănâncă scripting-ul nu are rost să încerci să deschizi servere pentru că nu o să ai jucători.Ți-aș propune să începi să înveți scripting pas cu pas cu resurse mici, apoi, după ce începi să te pricepi, să încerci un ditamai gm-ul complex de rp.
  4. look at the triggerClientEvent function parameters( always check the wiki before asking a question because it will help you alot )
  5. --CLIENT local headshotDamage = 200 -- damage to take when the player is shot in the head function onPlayerHeadshot( attacker, _, bodypart ) if not ( bodypart == 9 ) then return false end -- check if the player has been hit in the head if not ( getElementType( attacker ) == "player" ) then return false end -- check if the attacker is a player local playerHealth = getElementHealth( source ) -- get the player's health setElementHealth( source, playerHealth - headshotDamage ) -- set the player's new health cancelEvent() --cancel the event end addEventHandler( "onClientPlayerDamage", getRootElement(), onPlayerHeadshot )
  6. SheriFF

    Ajutor MOD

    Dacă ai deja modul clădirii( cele trei fișiere : .txd, .dff, .col ) folosește următorul script --CLIENT local COL, TXD, DFF function loadModel() COL = engineLoadCOL ( "nume_fisier.col" ) -- SCHIMBĂ nume_fisier CU NUMELE FIȘIERELOR PE CARE LE AI engineReplaceCOL ( COL, 3781--[[ ID-ul obiectului pe care vrei să-l schimbi ]] ) TXD = engineLoadTXD ( "nume_fisier.txd" ) engineImportTXD ( TXD, 3781 ) DFF = engineLoadDFF ( "nume_fisier.dff" ) engineReplaceModel ( DFF, 3781 ) end addEventHandler( "onClientResourceStart", getRootElement(), loadModel )
  7. @MrTasty @pa3ck thanks alot for your help, works just perfect <3
  8. What i am trying to make is a character creator system where the stats as age, height and weight must be selected using a scrollbar.The problem is that i can't think of an algorithm to do this Example : at the height scrollbar the player can choose between 150 and 250 cm. I need an algorithm to work with the guiScrollBarGetScrollPositon and transform it in a value between 150 and 250, how can i do this? ( a general formula would help alot )
  9. Replace addTracer with this : function addTracer( BUTTON, STATE ) if( BUTTON == "left" and STATE == "up" ) then outputChatBox( "guns fired" ) end end addEventHandler( "onClientClick", getRootElement(), addTracer )
  10. SheriFF

    Question

    getResources() -- with this function you get all the resources triggerClientEvent() --to send the resources to the client --[[ Example ( NOT TESTED ) ]] --SERVER function getAllResources() local RES_TABLE = getResources() if not ( RES_TABLE and type( RES_TABLE ) == "table" ) then --output an error return false end triggerClientEvent( source --[[ change source with your player element ]], "client.sendResources", source --[[ same here ]], RES_TABLE ) end --here add an event/command handler --CLIENT addEvent( "client.sendResources", true ) -- add the cliend-sided event function resNames_guiElements( RES_TABLE ) local COLUMN_WIDTH = 50 --Gridlist initialisation GRIDLIST = guiCreateGridList( --[[ fill here with the parameters ]] ) guiGridListAddColumn( GRIDLIST, "Resources", COLUMN_WIDTH ) for _, RESOURCE in ipairs ( RES_TABLE ) do -- Create the rows with the resources names local RES_NAME = getResourceName( RESOURCE ) guiGridListAddRow( GRIDLIST, RES_NAME ) end end addEventHandler( "client.sendResources", getRootElement(), resNames_guiElements )
  11. Please post the full script because, for example, prize is not declared Second, you don't have line 17 in your posted script Please tell us what the command is supposed to do( how it should work )
  12. Try, for example, id 128
  13. I think this can be achieved using setPedWalkingStyle function ( example : gangster walking style, gangster shooting type )
  14. This is just another idea( not tested ) , feel free to use and edit it as you wish --SERVER addEventHandler( "onPlayerSpawn", getRootElement(), function () triggerClientEvent( source, "player_onSpawn", source ) end ) --CLIENT addEvent( "player_onSpawn", true ) local SHOW_DIST = 50 local TAG_RADIUS = createColSphere( 0, 0, 0, SHOW_DIST ) function initialiseNametags() attachElements( TAG_RADIUS, localPlayer, 0, 0, 0 ) addEventHandler( "onClientRender", getRootElement(), renderNametags ) end addEventHandler( "player_onSpawn", getRootElement(), initialiseNametags ) local TAG_WIDTH, TAG_HEIGHT = 300, 50 function renderNametags() local CAM_X, CAM_Y, CAM_Z = getCameraMatrix() local PLAYERS_IN_RADIUS = getElementsWithinColShape( TAG_RADIUS, "player" ) for _, PLAYER in pairs ( PLAYERS_IN_RADIUS ) do local PLAYER_X, PLAYER_Y, PLAYER_Z = getElementPosition( PLAYER ) if isLineOfSightClear( PLAYER_X, PLAYER_Y, PLAYER_Z, CAM_X, CAM_Y, CAM_Z, true, false, false, true, false, false, localPlayer ) then local BONE_X, BONE_Y, BONE_Z = getPedBonePosition( PLAYER, 5 ) local TAG_X, TAG_Y = getScreenFromWorldPosition( BONE_X, BONE_Y, BONE_Z + 0.3 ) if ( TAG_X and TAG_Y ) then dxDrawText( getPlayerName( PLAYER ), TAG_X - TAG_WITH / 2, TAG_Y - TAG_HEIGHT / 2, TAG_X - TAG_WITH / 2 + TAG_WITH, TAG_Y - TAG_HEIGHT / 2 + TAG_HEIGHT, tocolor( 150, 50, 0 ), 1, "bankgothic" ) end end end end One mistake i saw was at dxDrawText.For example, if you want to draw a text at coords 10, 10 with the height of 50 and width of 100 you need to write something like dxDrawText( "text", 10, 10, 110, 60 ... ) ( the right and bottom must be coords, not the width and height )
  15. As i heard before( not sure tho ), a weapon doesn't represent a physical object like a ped or an object and a shader can't be applied to it. The solution here( if possible ) is to create a custom weapon system which uses actual objects as weapons ( engineApplyShaderToWorldTexture's optional arguments )
  16. Why don't you just uprgade your mta to the lastest version ( MTA:SA 1.5.4 ) ? It offers the possibility to play the race gamemode and alot of other cool gamemodes and it's map editor is veri stable
  17. SheriFF

    Object id

    That security thing is the part of the bottom land.Use 'Select world model' tool and check it by yourself
  18. Just use these functions createColCuboid() -- or any col shape "onColShapeHit" --event --example( not tested ) colShape = createColCuboid( --[[ fill here with the parameters ]] ) addEventHandler( "onColShapeHit", colShape, function( hitElement, dimension ) if not ( dimension ) then return false end if( isElement( hitElement) and getElementType( hitElement ) == "player" ) then local accName = getAccountName ( getPlayerAccount ( hitElement ) ) if not( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) ) then --teleport out of the colshape end end end )
  19. Event parameters addEventHandler ( "onPlayerVehicleExit", getRootElement(), function ( vehicle, seat, jacked ) if getVehicleType(theVehicle) == "Train" then detachTrailerFromVehicle(theVehicle) end end, )
  20. Use attachTrailerToVehicle function
  21. Fixed, fully functional code( thanks @ZoRRoM for the idea ) here function db_executeCommand( COMMAND, ... ) local VARS_TABLE = { ... } local DB_EXEC if ( VARS_TABLE and #VARS_TABLE > 0 ) then DB_EXEC = dbExec( DATABASE_CONNECTION, COMMAND, unpack( VARS_TABLE ) ) else DB_EXEC = dbQuery( DATABASE_CONNECTION, COMMAND ) end if not ( DB_EXEC ) then return false end return true end
  22. I tried to change some little things in this function and, by using assert, i found out that there are errors CODE: DATABASE_CONNECTION = dbConnect( "sqlite", "uhr.db" ) function db_executeCommand( COMMAND, ... ) local VARS_TABLE = { ... } local VARS_STRING = "" local VARS local DB_EXEC for INDEX, VAR in pairs( VARS_TABLE ) do VARS_STRING = VARS_STRING..",".."VARS_TABLE["..tostring( INDEX ).."]" end outputDebugString( "VARS_STRING : "..VARS_STRING:gsub( ",", "", 1 ) ) if ( VARS_STRING and VARS_STRING ~= "" ) then VARS = VARS_STRING:gsub( ",", "", 1 ) DB_EXEC = dbExec( DATABASE_CONNECTION, COMMAND, assert( loadstring( VARS ) )() ) else DB_EXEC = dbQuery( DATABASE_CONNECTION, COMMAND ) end if not ( DB_EXEC ) then return false end return true end Function test db_executeCommand( "INSERT INTO accounts( user, pass ) VALUES ( ?, ? )", "test", "test" ) --Output in debug panel : [string "VARS_TABLE[1],VARS_TABLE[2]"]:1:expected '=' near '<eof>'
  23. why don't you just verify if the amount is positive and bigger than 0 if ( amount > 0 and math.ceil( amount ) == amount --[[ verify if the amount is bigger than 0 and is an integer( doesn't contain decimals )]] ) then --code else outputChatBox( "The amount must be an integer bigger than 0" ) end
  24. I want this function to work with all dbExec commands ( INSERT, UPDATE etc... ) so i tried something like this DATABASE_CONNECTION = dbConnect( "sqlite", "uhr.db" ) function db_executeCommand( COMMAND, ... ) local VARS_TABLE = { ... } local VARS_STRING = "" local VARS local DB_EXEC for _, VAR in pairs( VARS_TABLE ) do if ( type( VAR ) == "string" ) then VARS_STRING = VARS_STRING..", ".."\""..VAR.."\"" else VARS_STRING = VARS_STRING..","..tostring( VAR ) end end if ( VARS_STRING and VARS_STRING ~= "" ) then VARS = VARS_STRING:gsub( ",", "", 1 ) DB_EXEC = dbExec( DATABASE_CONNECTION, COMMAND, loadstring( VARS ) ) else DB_EXEC = dbQuery( DATABASE_CONNECTION, COMMAND ) end if not ( DB_EXEC ) then return false end return true end but when i use, for example db_executeCommand( "INSERT INTO accounts( user,pass ) VALUES ( ?, ? )", theUser, thePass ) the value in the first column is nill and, in the second column are all the values stored
  25. I tried to make a function which executes a dbExec like this DATABASE_CONNECTION = dbConnect( "sqlite", "uhr.db" ) function db_executeCommand( COMMAND, ... ) local VARS = table.concat({...}, ",") local DB_EXEC if ( VARS ) then DB_EXEC = dbExec( DATABASE_CONNECTION, COMMAND, VARS ) else DB_EXEC = dbExec( DATABASE_CONNECTION, COMMAND ) end if not ( DB_EXEC ) then return false end return true end The problem is that only the first column is filled with all the variables For example : db_executeCommand( "INSERT INTO accounts( user, pass, word, staff, don, creatorSerial, saved, onSerial ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)", user, pass, word, "Member", "false", serial, "false", "" ) --user column : all variables --pass column empty --word column empty -- etc...
×
×
  • Create New...