-
Posts
822 -
Joined
-
Last visited
-
Days Won
86
Everything posted by The_GTA
-
line 25 replace with: outputChatBox("#FFFFFF[GANG] #00FFFF Você Passou pro level "..(getElementData(localPlayer,"level").. " na sua gang.",255, 255, 255, true ) Did you know that clientside outputChatBox does always only output the text for yourself, not other people?
-
In client.Lua replace line 7 with if not is_staff then This way FomeRepeat does never execute for staff members, under the same condition as mentioned in my previous post.
-
It looks like this character system does use many smooth camera transitions. For that you will have to use the MTA camera functions: smoothMoveCamera - useful function for interpolating a camera between two look-at points getCamera - for advanced effects used in combination with setElementPosition and setElementRotation setElementPosition setElementRotation I think you can figure out the character data into that MySQL table out yourself. Seems pretty straightforward, like character ID, name and language. Design-wise I recommend creating a scene for the character selection. You see that those characters are placed on tree-stumps. Think of something creative yourself, select a position on the map to put it and script the characters and the camera to be placed there. You may even want to play around with the MTA map editor. createObject - for creating background props at the character selection screen The DX overlay seems pretty basic. You should know about DX functions since we have recently talked about UI creation for an inventory system. getScreenFromWorldPosition - to get the position to draw DX at on the screen for attached-to-players overlay getPedBonePosition - you may want to get the position of the player head to draw the name at like in the video dxDrawLine3D - used for item placement highlight in the video At certain parts in the video (10:38) you see a message queue pop up above the player's head. Looks like a list of string messages that gets removed after a some timer has passed. I recommend writing a queue system yourself where you store the beginning time of each message and remove the items whose elapsedTime has reached 3 seconds during a server-side setTimer loop. You may want these functions: setTimer - creating a loop on the server to handle removal of messages getTickCount - check expire of single messages by calculating the elapsedTime the typical dx functions like dxDrawText and dxDrawRectangle I am curious. What kind of help are you expecting? You know that this is a lot of work, right?
-
Restarting the resource countless of times could mess with the perfomance of your server. People that know that a resource is restarted on vehicle spawn could look into abusing your server. Thus I would rather recommend turning the handling script into a global function and calling it on each vehicle spawn, on the sole condition that you do not want to create a dynamic handling script? But if you were to want to call restartResource, then you'd have to give access rights using the ACL.xml file for that function.
-
https://github.com/multitheftauto/mtasa-blue/issues/553 https://github.com/multitheftauto/mtasa-blue/issues/1198 Sorry, but there are bugs in MTA.
-
Dear iwalidza, since I have helped you do the login system with MySQL I think you did get some experience with it. Let's discuss the design aspects of a character system. I think you want to have two tables: one table for the character itself and a second for items that belong to the character. The first table should store accountName, skinID, character_id, currentHealth, currentArmor, maxHealth, money, last_x, last_y, last_z and last_rotation. Thus we could have this code: server.Lua local function restore_character(player, char_id) local account = getPlayerAccount(player); if not (account) then return false, "player has no account"; end; local accountName = getAccountName(account); if not (accountName) then return false, "no account name"; end; local query = dbQuery(db_conn, "SELECT * FROM characters WHERE accountName='?' AND character_id='?'", accountName, char_id); if not (query) then return false, "player character does not exist"; end; local results = dbPoll(query, -1); dbFree(query); local char_res = results[1]; -- Restore the character. setElementModel(player, tonumber(char_res.skinID)); setElementHealth(player, tonumber(char_res.currentHealth)); setPedArmor(player, tonumber(char_res.currentArmor)); setElementPosition(player, tonumber(char_res.last_x), tonumber(char_res.last_y), tonumber(char_res.last_z)); setPedRotation(player, tonumber(char_res.last_rotation)); setPlayerMoney(player, tonumber(char_res.money)); return true; end local function get_player_characters(player) local account = getPlayerAccount(player); if not (account) then return false, "no player account"; end; local accountName = getPlayerAccount(account); if not (accountName) then return false, "no account name"; end; local query = dbQuery(db_conn, "SELECT character_id, skinID FROM characters WHERE accountName='?'", accountName); if not (query) then return false, "query failed"; end; local results = dbPoll(query, -1); if not (results) then return false, "polling query results has failed"; end; return results; end I think the saving code is a good exercise.
-
I have fixed a mistake I made at addCommandHandler. Sorry about that. Please copy the client script again.
-
--client function rain(kaka) outputChatBox ( "The client says: " .. kaka ) end addEvent("rain", true) addEventHandler( "rain", resourceRoot, rain ) addCommandHandler("gh", function() triggerServerEvent("gap", resourceRoot) end) --server function gap() local kaka = "321" triggerClientEvent(client, "rain", resourceRoot, kaka) end addEvent( "gap", true ) addEventHandler( "gap", resourceRoot, gap ) EDIT: fixed something by adding "client" global variable. Sorry I have forgotten about the existance of it for a second. EDIT2: sorry another mistake fixed at addCommandHandler...
-
Np, just create a folder called "zee_modloader" and paste the contents of the .zip into there. If you want dynamic support then put the "zee_modloader" resource as Moderator in your ACL.xml file. <group name="Moderator"> <acl name="Moderator"></acl> <object name="resource.mapcycler"></object> <object name="resource.mapmanager"></object> <object name="resource.resourcemanager"></object> <object name="resource.votemanager"></object> <object name="resource.zee_modloader" /> <!-- this line over here !--> </group> When you are done installing it just type "start zee_modloader". Please read the resource documentation for further details (installing mods, etc).
-
OK. Let's take your requirements into account. Is a server-side commandHandler called "gh" fine for you? --client function rain(kaka) outputChatBox ( "The client says: " .. kaka ) end addEvent("rain", true) addEventHandler( "rain", resourceRoot, rain ) --server function gap() local kaka = "321" triggerClientEvent("rain", resourceRoot, kaka) end addEvent( "gap", true ) addEventHandler( "gap", resourceRoot, gap ) addCommandHandler("gh", function(p, cmdName) gap() end)
-
Welcome to the MTA forums, zee_! Have you tried using the modloader resource? It is made by an old friend of mine and I remember that it worked well. I recommend using a ready-made resource first. Maybe if you feel like it you can script your own optimized stuff in the future.
-
The reason is because you have not defined the variable "kaka" for the command handler "gh". If you type "/gh 321" into the chat, then it should work. --client function rain(kaka) outputChatBox ( "The client says: " .. kaka ) end addEvent("rain", true) addEventHandler( "rain", resourceRoot, rain ) addCommandHandler("gh", function(cmdName, kaka) if not kaka then outputChatBox("missing kaka argument to gh command"); return end rain(kaka) end )
-
What did you do to get this error?
-
--client function rain(kaka) outputChatBox ( "The client says: " .. kaka, client ) end addEvent("rain", true) addEventHandler( "rain", resourceRoot, rain ) addCommandHandler("gh",function(cmdName, kaka) rain(kaka) end)
-
I like helping you by example. I cannot understand the purpose behind your script so I can only give you general advice: Most of the time just use root as baseElement for triggerClientEvent. If the event is limited to a resource then use resourceRoot. And if you want the event to be applied to a vehicle or object across resources then use that element. --client function rain(kaka) outputChatBox ( "The client says: " .. kaka, client ) end addEvent("rain", true) addEventHandler( "rain", resourceRoot, rain ) --server function gap() local kaka = "321" triggerClientEvent("rain", resourceRoot, kaka) end addEvent( "gap", true ) addEventHandler( "gap", resourceRoot, gap ) You probably won't understand why I removed the first argument to triggerClientEvent, but only use localPlayer if you know which player element to send the event to. ??
-
Hello lockdw, you have to use the setVehicleHandling function. On the wiki page there is an excellent example on how to do so: local predefinedHandling = { [411] = { ["engineAcceleration"] = 14, ["dragCoeff"] = 0, ["maxVelocity"] = 100000, ["tractionMultiplier"] = 0.9, ["tractionLoss"] = 1.1, }, [415] = { ["engineAcceleration"] = 14, ["dragCoeff"] = 0, ["maxVelocity"] = 100000, ["tractionMultiplier"] = 0.9, ["tractionLoss"] = 1.1, }, [562] = { -- Universal drift handling ["driveType"] = "rwd", ["engineAcceleration"] = 200, ["dragCoeff"] = 1.5, ["maxVelocity"] = 300, ["tractionMultiplier"] = 0.7, ["tractionLoss"] = 0.8, ["collisionDamageMultiplier"] = 0.4, ["engineInertia"] = -175, ["steeringLock"] = 75, ["numberOfGears"] = 4, ["suspensionForceLevel"] = 0.8, ["suspensionDamping"] = 0.8, ["suspensionUpperLimit"] = 0.33, ["suspensionFrontRearBias"] = 0.3, ["mass"] = 1800, ["turnMass"] = 3000, ["centerOfMass"] = { [1]=0, [2]=-0.2, [3]=-0.5 }, -- Good example to understand centerOfMass parameter usage }, --next model below etc (copy rows) } for i,v in pairs (predefinedHandling) do if i then for handling, value in pairs (v) do if not setModelHandling (i, handling, value) then outputDebugString ("* Predefined handling '"..tostring(handling).."' for vehicle model '"..tostring(i).."' could not be set to '"..tostring(value).."'") end end end end for _,v in ipairs (getElementsByType("vehicle")) do if v and predefinedHandling[getElementModel(v)] then for k,vl in pairs (predefinedHandling[getElementModel(v)]) do setVehicleHandling (v, k, vl) end end end function resetHandling() for model in pairs (predefinedHandling) do if model then for k in pairs(getOriginalHandling(model)) do setModelHandling(model, k, nil) end end end for _,v in ipairs (getElementsByType("vehicle")) do if v then local model = getElementModel(v) if predefinedHandling[model] then for k,h in pairs(getOriginalHandling(model)) do setVehicleHandling(v, k, h) end end end end end addEventHandler("onResourceStop", resourceRoot, resetHandling) I recommend that you first play around with the hedit resource and then just copy the values over to your script.
-
Hello MaRcell, sounds like you want to use the getWorldFromMapPosition function using a range value of 180. Feel free to ask any further questions about it.
-
Hello slapztea, line 2: on the clientside, the outputChatBox function does not take an element but a color number value as second argument. line 11: the global variable "localPlayer" does not exist on the server-side; you either could use root to send to all players or select a specific player instead using getPlayerFromName/getElementsByType/etc. I think that your script does have a working idea behind it; you just have to improve it a little.
-
Dear DigDim, if you restart the resource each time you update the ACL then you can just send the ACL info from server to client. server.Lua addEvent("onPlayerReady", true); addEventHandler("onPlayerReady", resourceRoot, function() local has_staff = isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(client)), aclGetGroup ("Staff")); triggerClientEvent(client, "onClientReceivePermissions", resourceRoot, has_staff); end, false ); client.Lua local has_got_perms = false; local is_staff = false; function FomeRepeat() if is_staff then if getElementData ( localPlayer, "afkdate" ) == true then return end if getElementData ( localPlayer, "Fome:Logado" ) == true then Fome = getElementData ( localPlayer, "AirNew:Fome" ) -1 SetarFome = setElementData ( localPlayer, "AirNew:Fome", Fome ) if Fome <= 0 then setElementData ( localPlayer, "AirNew:Fome", 10 ) setElementHealth ( localPlayer, 0 ) outputChatBox ( "[ Fome ] - Você Morreu de Fome", 255, 255, 255, true ) outputChatBox ( "[ Fome ] - Vá Até uma Lanchonete e Coma Algo, ou Você Vai Morrer Novamente", 255, 255, 255, true ) end if Fome == 5 then outputChatBox ( "[ Fome ] - Você Esta com Fome e Precisa Comer", 255, 255, 255, true ) outputChatBox ( "[ Fome ] - Vá Até uma Lanchonete e Coma Algo, ou Você Vai Morrer de Fome", 255, 255, 255, true ) playSoundFrontEnd ( 45 ) end end end end addEvent("onClientReceivePermissions", true); addEventHandler("onClientReceivePermissions", resourceRoot, function(_is_staff) has_got_perms = true; is_staff = _is_staff; outputDebugString( "received client permissions (is_staff: " .. tostring(_is_staff) .. ")" ); setTimer(FomeRepeat,FomeTempo,0) end, false ); triggerServerEvent("onPlayerReady", resourceRoot);
-
Hello valerr7, sorry but I cannot understand what you want exactly but I get that you want to change the position and rotation of the vehicle. Try using the setElementPosition and setElementRotation functions. For example in line 9: setElementPosition(veh, 0, 0, 0) setElementRotation(veh, 0, 0, 0)
-
Sure, the easiest way to check for location change is the onClientRender event in combination with the getZoneName function. Here is a small example. local last_zone = false; local function on_zone_change(zone_name) -- TODO: new zone is in the "zone_name" variable. -- do something here to change the weather. end local function get_relevant_position() local cam_target = getCameraTarget(); if (cam_target) then return getElementPosition(cam_target); end return getElementPosition(getCamera()); end addEventHandler("onClientRender", root, function() local px, py, pz = get_relevant_position(); local cur_zone = getZoneName(px, py, pz); if not (last_zone) or not (last_zone == cur_zone) then on_zone_change(cur_zone); last_zone = cur_zone; end end ); This code does use the position of the camera target or of the camera, depending on what makes most sense.
-
Then you have to look into the source code of the shader resource to find an on-or-off switch. Considering that you have not even shared the name of the resource yet alone the content... ?
-
Dear slapztea, your problem sounds very similar to a question that has been asked before: Other than that, if you want to define custom zones then just use colshape rectangles with the onClientColShapeHit event.