# Uisaqin

Members

12

0 Neutral

• Rank
Square
1. ## Help! TextDisplay onPlayerJoin

function showTextDisplay ( ) http://wiki.multitheftauto.com/wiki/OnPlayerJoin

3. ## Problem with Image on screen(Resolutions problem)

if its at screenWidth - 700 pixels on your screen, thats 1440 - 700 = 740 pixels from the left. or relative: 740 / 1440 = 0.51388888888888888888888888888889 so this should make it look the same on any resolution local x1 = screenWidth*0.5139
4. ## Problem with Image on screen(Resolutions problem)

display the image on your screen using the width and height of the image file, if it displays too big then yeah keep making the image smaller until it looks good
5. ## Problem with Image on screen(Resolutions problem)

find the width and height in pixels the image looks good at on your resolution eg. 200 x 250 then do 200 / 1440 = 0.139 and 250 / 900 = 0.278 then just update the floats local ImageWidth = 0.139 local ImageHeight = 0.278
6. ## Problem with Image on screen(Resolutions problem)

u can make the image display on any resolution if u use floats between 0 and 1 (relative positioning) -- image settings local ImageX = 0.45 local ImageY = 0.8 local ImageWidth = 0.5 local ImageHeight = 0.5 -- calculate pixel positions local ScreenWidth, ScreenHeight = guiGetScreenSize() ImageX = ScreenWidth * ImageX ImageY = ScreenHeight * ImageY ImageWidth = ScreenWidth * ImageWidth ImageHeight = ScreenHeight * ImageHeight
7. ## Healthlul's

first plan the colors u want for different health ranges hp = rgb 100 = 0 255 0 (green) 50 = 255 255 0 (yellow) 0 = 255 0 0 (red) then u can try something like function getHealthColour(Health) if Health >= 50 then return math.ceil((((Health / 50) - 1) * 255)), 255, 0 else return 255, math.ceil((Health / 50) * 255), 0 end end
8. ## Mysql

local query = mysql_query(handler, "SELECT * FROM players WHERE username = '"..username.."'") also escape username and password variables with mysql_escape_string() before putting them into the query string so you are protected against sql injection
9. ## string.fin/gsub

try if string.find(g_MapInfo.name, "[DM]", 1, true) then -- disable pattern matching on [ ] g_MapInfo.name = string.gsub(g_MapInfo.name, '%[DM%]', '#ff0000[DM]#236B8E') -- escape [ ] with %[ %] end
10. ## censorship help!

epic fail. ok. No one mentioned anything about separate resources or exports, just separate scripts. Dunno what your saying about using return, i was demonstrating how to stop an event's execution from another, as im guessing cancelEvent() will not stop the next event functions being called. Not that it should, of course.
11. ## censorship help!

function onPlayerChatCensor(Text, Type) ChatCensored = false if Text == 'fuk' then ChatCensored = true end end addEventHandler('onPlayerChat', root, onPlayerChatCensor) function onPlayerChatCustom(Text, Type) cancelEvent() if ChatCensored then return end outputChatBox(Text) end addEventHandler('onPlayerChat', root, onPlayerChatCustom) onPlayerChatCensor must be called before onPlayerChatCustom, so load censor script first, or if both are in same script call onPlayerChatCensor's addEventHandler first
12. ## math related question, impress everyone and solve it!

what about using 2 of these functions http://wiki.multitheftauto.com/wiki/Useful_Functions something like function getLineHitAngle(Point1X, Point1Y, Point1Z, Point2X, Point2Y, Point2Z) local Hit, HitX, HitY, HitZ = processLineOfSight(Point1X, Point1Y, Point1Z, Point2X, Point2Y, Point2Z) if Hit then local LineAngle = findRotation(Point1X, Point1Y, Point2X, Point2Y) local LineDistance = 2 local Point3X, Point3Y = getPointFromDistanceRotation(Point1X, Point1Y, LineDistance, LineAngle - 90) local Point4X, Point4Y = getPointFromDistanceRotation(Po
×

• #### MTA Network

×
• Create New...