- 
                Posts6,089
- 
                Joined
- 
                Last visited
- 
                Days Won216
Everything posted by IIYAMA
- 
	Round your values: down, up or both. math.random require an integer value and not a float value. int: 1 float: 1.11111111111111111111111111111 Down local upperbound = math.floor(upperbound) local lowerbound = math.floor(lowerbound) Up local upperbound = math.ceil(upperbound) local lowerbound = math.ceil(lowerbound) Both local upperbound = math.floor(upperbound+0.5) local lowerbound = math.floor(lowerbound+0.5)
- 
	Because the developer of a script is a designer. Not always a graphical designer, but also a designer of a system made by code. When you rip code out of a script, the design changes. Most of the time the design becomes uglier because 90% don't understand how it works. Ugly in a way that it doesn't work well any more, ugly in the interaction with the user or ugly at the level of graphical design(gui's, dx). But that is not the problem, the problem lies with the publishing. Two ways of publishing, with negative attention for the developer: - Badly edited the resource and published it on a server. And it will shows all visitors how badly you(developer) designed it. And no they will not look at the unknown person that edited it, but YOU as developer. - Ripping out the code and places it in badly designed resource. Mostly without author copy right. They will be reminded by the code you published before and make that LINK between your resource and that badly designed one.
- 
	When you change your image to 1 color and export(web) it as png-8. You won't have that problem any more. png-24 is kinda tricky to draw with a lot alpha blending. But check your photoshop export settings correctly! The png-8 settings from photoshop are not correct by default! Also you might want to try dxCreateTexture first. - Speeds up the render speed. - Can be compressed with dxt1,dxt3,dxt5. For using less GPU(video card) memory. I recommend dxt5. - Two ways to render the edges: wrap and clamp Difference between png-8 (left) and png-24 (right):
- 
	You can detect it with: local camPosX, camPosY, [color=#FF0000]camPosZ[/color] = getPedBonePosition ( lp, 8 ) Line: 46 t/m 69 is for the leaning left and right, you can rip it out < reason why I compile my scripts....
- 
	Post your code first, that is a rule in this section.
- 
	I solved it. The column wasn't created by another problem in the resource. Thank you all!
- 
	And how will this structure be look like? This? result = { [1] = { ["area"] = value, ["data"] = value } } I ended up with: local query = dbQuery(DB_connection, "SELECT * FROM `world` WHERE `area` = ?", gridX .. "/" .. gridY) if query then local result, rows = dbPoll(query, -1) if result then if rows ~= 0 and type(result) == "table" and #result ~= 0 then dbExec(DB_connection, "INSERT INTO `world` VALUES(area,value)",gridX .. "/" .. gridY,toJSON(worldPartTable)) else dbExec(DB_connection, "UPDATE `world` SET `value` = ? WHERE `area` = ?",toJSON(worldPartTable),gridX .. "/" .. gridY) end else dbFree( query ) end end And this warning: This sql request: "UPDATE `world` SET `value` = ? WHERE `area` = ?"
- 
	Well the structure I want is this: result = { [1] = { ["columnName"] = value, ["columnName"] = value, ["columnName"] = value } } I want 1 key and a value. I don't want more rows. But if that is incorrect, how should I put it? "UPDATE `world` SET `data` = ? WHERE `area` = ?" Like this? "UPDATE `world` SET `area` = ?" or this? "UPDATE `world` SET `area` = ? WHERE `area` = ?" or must I change the inset into?
- 
	Hi, I can't figure out why my system isn't saving and loading. Can somebody check my code? Thank you! -- loading -- local query = dbQuery(DB_connection, "SELECT * FROM `world` WHERE `area` = ?", gridX .. "/" .. gridY) if query then outputDebugString("query") local result, rows = dbPoll(query, -1) if rows ~= 0 and type(result) == "table" and #result ~= 0 then worldPartTable = fromJSON(result[1]) outputDebugString("Loaded from DB") end end ------------ -- storing -- local query = dbQuery(DB_connection, "SELECT * FROM `world` WHERE `area` = ?", gridX .. "/" .. gridY) if query then local result, rows = dbPoll(query, -1) if result then if rows == 0 then dbExec(DB_connection, "INSERT INTO `world` (area) VALUES (?)", gridX .. "/" .. gridY) end local resultOfUpdate = dbExec(DB_connection, "UPDATE `world` SET `data` = ? WHERE `area` = ?",toJSON(worldPartTable),gridX .. "/" .. gridY) outputChatBox("resultOfUpdate: " .. tostring(resultOfUpdate)) else dbFree( query ) end end ----------- -- onResourceStart -- DB_connection = dbConnect ( "sqlite", "file.db" ) if DB_connection then outputChatBox("connected to db") dbExec(DB_connection, "CREATE TABLE IF NOT EXISTS `world` ( area TEXT )") else local cancelReason = "MTA_map_generator: db failed to load." outputDebugString(cancelReason) cancelEvent(true,cancelReason) end ---------------------
- 
	It doesn't. When the ped is on the ground it gets limited by the GTA default running/walking speed. When you overuse setElementVelocity you will get yourself flying. But setElementVelocity can increase the acceleration speed of a ped t/m the speed limit.
- 
	https://wiki.multitheftauto.com/wiki/Math.round
- 
	Remove > local < from line 3. When you set a variable to a local, it can only be used within the block and only in the lines bellow. Line 1 t/m 7 is a block, a function block. function createMachineGun(theWeapon, theState) local x, y, z = getElementPosition(getLocalPlayer()) local weapon = createWeapon("m4", x, y, z + 1) setWeaponClipAmmo(weapon, 100) setWeaponState(weapon, "ready") setWeaponFiringRate ( weapon , 30 ) end addEventHandler('onClientResourceStart', getRootElement(), createMachineGun) When you place a local variable outside a block(not in function/if elseif then do), the whole document will be considered as block.
- 
	triggerServerEvent("reload",[color=#FF0000][u]localPlayer[/u][/color],[color=#00FF00]localPlayer[/color]) function reloadTimer( [color=#00FF00]thePlayer[/color] ) outputChatBox ( "ddddddd" ) --local [color=#FF0000]sourceElement[/color] = [color=#FF0000]source[/color] setTimer ( callbackMarkerHit, 4000, 1,[color=#00FF00]thePlayer[/color] ) end addEvent( "reload", true ) addEventHandler( "reload", [color=#FF0000][u]resourceRoot[/u][/color], reloadTimer ) Activation element of the addEventHandler: addEventHandler + resourceRoot element only accepts the resourceRoot element. When you want this event to be able to activate by more element types, use root < IN THE addEventHandler. RED clientside = RED serverside GREEN clientside = GREEN serverside Two ways to fix the code: triggerServerEvent("reload",resourceRoot,localPlayer) or addEventHandler( "reload", root, reloadTimer )
- 
	Remove 'end' at line 5. Because there are end's for a reason... which is for closing a block of a function or conditions states etc. Replace line 13 with: setTimer ( callbackMarkerHit, 5000, 1,thePlayer ) Because you have to tell the timer that you are sending some extra information to another function.
- 
	The setFarClipDistance function goes as far as the CPU(1 core only, gta doesn't support multiply cores) can handle it. And there is also this: GTA (world) objects have streamed-in priority, some objects will be faster visible than others. My suggestion: Don't overuse setFarClipDistance, but render the map instead when you reach an amount of height.
- 
	dxDraw the image: MTA San Andreas 1.6\MTA\cgui\images\radar.jpg on the background, so when you zoom out, it will still be visible.
- 
	I have never set health for an object. You should use an alternative, like tables or elementdata to make it perfect.
- 
	Ah yea, I was worried about losing the votes. But it seems it remains correct. Thx for the reminder. =)
- 
	If you really want to fix this by lua, you can use: https://wiki.multitheftauto.com/wiki/OnVehicleExplode to check the daily between the explosions. When a vehicle is exploding more than 3 times per 300 ms, you recreate the vehicle. But make sure this is not a vehicle from the race resource.
- 
	local playerX,playerY,playerZ = getElementPosition(localPlayer) local playerX,playerY,playerZ = getElementPosition(getCamera()) I just saw a little mistake in it or well, it might be more a visual. In the code on top, I took the position of the localPlayer, but the result would be better when you use the position of the camera.
- 
	The reason behind losing the vehicle parts: The server syncs the vehicle as blown. But for the owner/syncer of the vehicle it isn't blown. The syncer is sending to the server that the vehicle is still operating, which is divided over the players. But the server is also saying that it has been blown... so fixed > blow > fixed > blow etc. This is a synchronization bug, I haven't found out why it is happening. But it might have something to do with freezing a vehicle at serverside.

 
            
        