-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Everything posted by IIYAMA
-
"user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin") ) Indeed. What was source again in this event? Can you get the account from a ... ? Answer: What happens when you do that? Can you get the accountname of the value false? So:
-
it means that the variable which should contain the player isn't containing it. If you use the event onVehicleStartEnter, use the first parameter for the player. https://wiki.multitheftauto.com/wiki/OnVehicleStartEnter Parameters: player enteringPlayer, int seat, player jacked, int door Source: The source is in this event the vehicle. Example: function enterVehicle ( player, seat, jacked ) if vehicleEnterExceptions[player] or (staffcar[getElementModel(player)] and not isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ("Admin") )) then
-
By making exceptions local vehicleEnterExceptions = {} -- function if vehicleEnterExceptions[player] or (staffcar[getElementModel(source)] and not isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin") )) then -- end function addPlayerToException (player) vehicleEnterExceptions[player] = true return true end function removePlayerFromException (player) vehicleEnterExceptions[player] = nil return true end addEventHandler("onPlayerQuit", root, function () removePlayerFromException (source) end) addPlayerToException (player) -- DO > https://wiki.multitheftauto.com/wiki/WarpPedIntoVehicle setTimer(removePlayerFromException, 50, 1, player) -- Events are afaik async, so must this function call. You could try something like this. (untested)
-
Maybe you could ask it to somebody who already has done it, or the one who created the wiki topic. I am very sure those guys are out there.
-
To be able to do that, you have to learn how to communicate between client(player his pc) and the server(can also be the player his pc or another computer). GUI = clientside. Giving weapons, take money away(synced) = serverside You need to be able to understand this, even if you run your server on your own machine: The fibreculture journal. (z.d.). Architecting Cheating in MMORPGs [Foto]. Geraadpleegd van http://sixteen.fibreculturejournal.org/files/2010/07/Figure_3.jpg This tutorial might be handy.
-
hmm, well to figure out the problem, should start with try the same thing on another (2) server(s). Just to be sure that it isn't the server.
-
I think you should do some more digging in the server. Because it is almost as if the Firewall is blocking it. Also check the mta config file at that server, on this: <!-- This parameter specifies the TCP port on which the server will be accepting incoming http connections. It can be set to the same value as <serverport>. It is a required parameter if <httpserver> is set to 1. --> <httpport>22005</httpport>
-
Did you make sure you added this to the meta.xml? (on the resource where this function is located) <export function="outputChatBoxRemote" http="true" />
-
I am not sure if you can call remote to yourself. But the error 404 means not found. So try to ping to the ip, just to check if it available. Also the port is important, just to figure out which port you should use: function playerChat ( message, type ) for port=22000, 22030 do callRemote ( "87.229.77.40:" .. port, getResourceName(getThisResource()), "outputChatBoxRemote", finishedCallback, getPlayerName(source), message, type, getServerPort() ) end end
-
dbQuery + dbPoll for sql.
-
Use the aggregate COUNT function: https://dev.mysql.com/doc/refman/5.7/en/counting-rows.html Here you have more related functions: https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html
-
Render events enhancement Having a lot of render events in your resource? Easier attach and remove? Or do you want to pass arguments in to a function which is attached to a render event? Then this might be something for you. Syntax: addRenderEvent bool addRenderEvent(function functionVar [, string eventName, arguments ...]) Arguments: The function you want to attach/target. The event you want to use. ( "onClientRender", "onClientPreRender", "onClientHUDRender") If you do not fill in one of these three, it will automatic fallback to "onClientRender". Fool proof. Arguments you can pass to the target function. (which isn't possible with the default addEventHandler + onClientRender function) Returns: true when added, and false otherwise. Syntax: removeRenderEvent bool removeRenderEvent(function functionVar [, string eventName]) Arguments: The function you want to attach/target. The event you want to use. ( "onClientRender", "onClientPreRender", "onClientHUDRender") If you do not fill in one of these three, it will automatic fallback to "onClientRender". Fool proof. Returns: true if found + removed, and false otherwise. (Not recommended to execute this function every frame > performance) onClientPreRender + timeslice If you use "onClientPreRender", just like the default event, it will pass the timeSlice to the attached/targetted function. https://wiki.multitheftauto.com/wiki/OnClientPreRender I am not sure if attached is the right word for this example, because it isn't really attached to the event. It is saved in a table which gets looped every frame. Performance Is this code bad for performance? The answer to that is NO. I ran a test for it, and it seems that addRenderEvent used less CPU AFTER adding the events. (addRenderEvent: 31% CPU, addEventHandler 99/100% CPU) Adding the event will probably use more CPU, but that is only one execution. Feel free to re-test this example, I am interested how it would perform on your pc's. Performance test code (Not the source code ) Source code:
- 21 replies
-
- 12
-
-
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with:
-
if ( staffcar[getElementModel(source)] ) and ( not isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin") )) then Or even better if you do not want to be confused: if staffcar[getElementModel(source)] and not isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ("Admin") ) then I prefer the last one. Only wrapping code between (...) when really needed.
-
Did you found another solution?
-
https://wiki.multitheftauto.com/wiki/GetScreenFromWorldPosition (Put high edgeTolerance) https://wiki.multitheftauto.com/wiki/DxDrawLine
-
I know, but you did both, so maybe that could have caused problems. I am not an expert with shaders, so everything is maybe this and maybe that.?
-
addEventHandler ( "onPlayerLogin", root, function (_, theCurrentAccount ) setPlayerName ( source, getAccountName(theCurrentAccount) ) end) https://wiki.multitheftauto.com/wiki/GetAccountName string getAccountName ( account theAccount ) https://wiki.multitheftauto.com/wiki/OnPlayerLogin Parameters thePreviousAccount: The account the player was logged into before theCurrentAccount: The account the player logged into just now Source The source of this event is the player element that just logged in.
-
@Vuzimir This is what I get for trying to help you? Really? REALLY? Don't get paranoid, I have already more than enough posts and I am replying to YOU in MY FREE TIME. You are not even editing the z offset. It is set to 0. So then why would yours look so :~ty? The only thing I can think of, is either your shader file or your GPU. But if you have edited it, then it is really stupid to post code where it is not edited. dxSetShaderTransform ( myShader4, -30, 0, -2.7, 0, 0, 0, false, 0, 0, false) bool dxSetShaderTransform ( element theShader, float rotationX, float rotationY, float rotationZ, [ float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, float rotationCenterOffsetZ = 0, bool bRotationCenterOffsetOriginIsScreen = false, float perspectiveCenterOffsetX = 0, float perspectiveCenterOffsetY = 0, bool bPerspectiveCenterOffsetOriginIsScreen = false ] )
-
The very basic shader works perfect for me: dxSetShaderTransform (mapShader, 0, -60, rotation) texture gTexture; technique IIYAMA { pass P0 { Texture[0] = gTexture; } }
-
You do not have to write the loop yourself. Add the custom function I wrote for you on top of your script. function isElementWithinMarkers (element, markers) for i=1, #markers do if isElementWithinMarker(element, markers[i]) then return true end end return false end And just apply this part: function RepairVehicle( hitPlayer, matchingDimension ) if hitPlayer == getLocalPlayer() and matchingDimension == true then local theVehicle = getPedOccupiedVehicle( getLocalPlayer() ) local VehicleHealth = getElementHealth( theVehicle ) local RepairHealth = math.floor( VehicleHealth ) function Repair() --if isElementWithinMarker( getLocalPlayer(), RepairMarker[1] ) then -- old -- >>>>>>>>>>>>>> if isElementWithinMarkers( getLocalPlayer(), RepairMarker ) then -- new -- <<<<<<<<<<<<<< if RepairHealth < 1000 then RepairHealth = RepairHealth + 1 setElementHealth( theVehicle, RepairHealth ) else fixVehicle( theVehicle ) playSFX( "script", 11, 1, false ) end else killTimer( RepairTimer ) end end if VehicleHealth < 1000 then RepairTimer = setTimer( Repair, 100, 1001 - math.floor( VehicleHealth ) ) end end end
-
function isElementWithinMarkers (element, markers) for i=1, #markers do if isElementWithinMarker(element, markers[i]) then return true end end return false end if isElementWithinMarkers( getLocalPlayer(), RepairMarker ) then Syntax: bool isElementWithinMarkers( element theElement, table markers ) By looping through all markers and check if the element is in one of the markers. If that is true, then break the loop with the return keyword and send true back. Note: (different name) isElementWithinMarker + s
-
I think that it depends on the shader. Because tocolor didn't work with the shaders I tried.
