
drk
Members-
Posts
1,607 -
Joined
-
Last visited
Everything posted by drk
-
WTF! Can you speak English and tabulate your code? Your code: function health(player,cmd) outputChatBox("* ("..getPlayerName(player..") typed /myhealth. His health is: "..getElementHealth(player),root,255,12,15,false) end addCommandHandler('myhealth',health)
-
Only delete other maps lol Or create a script that restarts the map when the map stops like: addEventHandler('onGamemodeMapStop',root, function() startResource("yourMapResourceName") -- not the map name, the folder/zip name of your map outputChatBox("Playing "-----Your map name"------"!",root,255,255,255,true) end )
-
I don't understand what you did. Can you explain better?
-
local enabled = true local setcolorativado = false function enabled() if enabled then engineApplyShaderToWorldTexture ( myShader, "smoke" ) outputChatBox ( "NITRO: Shader activated!",localPlayer ) dxSetShaderValue(myShader,'gNitroColor',math.random(0,255),math.random(0,255),math.random(0,255),255) setcolorativado = true else engineRemoveShaderFromWorldTexture ( myShader, "smoke" ) outputChatBox ( "NITRO: Shader disabled!",getLocalPlayer() ) setcolorativado = false enabled = false end end setTimer(enabled,900,0) You mean this?
-
MTA:SA not recognize rar files. Only zip and folders.
-
It's too long. About 300 lines I will show only the profile part. Client-side: --profile choose image profile['img'] = guiCreateStaticImage((268/800)*sx,(98/600)*sy,(395/800)*sx,(309/600)*sy,"_utils/_data/_image/grid.png",false) profile['img_select'] = guiCreateGridList((32/800)*sx,(19/600)*sy,(153/800)*sx,(268/600)*sy,false,profile['img']) guiGridListSetSelectionMode(profile['img_select'],0) guiSetAlpha(profile['img_select'],0.-- s8) --> profile['img_preview'] = guiCreateStaticImage((208/800)*sx,(30/600)*sy,(157/800)*sx,(199/600)*sy,"_utils/_data/_image/radar.png",false,profile['img']) profile['set'] = guiCreateButton((200/800)*sx,(249/600)*sy,(82/800)*sx,(27/600)*sy,"Set",false,profile['img']) guiSetAlpha(profile['set'],0.9) profile['cancel'] = guiCreateButton((288/800)*sx,(248/600)*sy,(82/800)*sx,(27/600)*sy,"Cancel",false,profile['img']) guiSetAlpha(profile['cancel'],0.9) local column = guiGridListAddColumn(profile['img_select'],'Image',0.-- s8) --> if column then for name, dir in pairs(imageList) do local row = guiGridListAddRow(profile['img_select']) guiGridListSetItemText(profile['img_select'],row,column,tostring(name),false,false) guiGridListSetItemData(profile['img_select'],row,column,tostring(dir)) end end --main script guiSetVisible(gui['window'],false) guiSetVisible(profile['window'],false) guiSetVisible(profile['img'],false) addEventHandler('onClientGUIClick',root, function() if source == gui['button1_name'] then guiSetVisible(profile['window'],not guiGetVisible(profile['window'])) elseif source == profile['save_label'] then triggerServerEvent('onClickSave',localPlayer,getPlayerName(localPlayer),guiGetText(profile['name_memo']),guiGetText(profile['birthday_m']),guiGetText(profile['birthday_d']),guiGetText(profile['birthday_y']),guiGetText(profile['mail_memo']),getElementData(localPlayer,'Image')) triggerServerEvent('onSaveSettings',localPlayer) elseif source == profile['img_choose'] then guiSetVisible(profile['window'],false) guiSetVisible(profile['img'],true) elseif source == profile['img_select'] then local row, col = guiGridListGetSelectedItem(source) if row and col and row ~= -1 and col ~= -1 then local dir = guiGridListGetItemData(source,row, col) guiStaticImageLoadImage(profile['img_preview'],dir) end elseif source == profile['cancel'] then guiSetVisible(profile['img'],false) guiSetVisible(profile['window'],true) showCursor(true) elseif source == profile['set'] then local row, col = guiGridListGetSelectedItem(profile['img_select']) if row and col and row ~= -1 and col ~= -1 then local dir = guiGridListGetItemData(profile['img_select'],row, col) guiStaticImageLoadImage(profile['image'],dir) setElementData(localPlayer,'Image',dir) guiSetVisible(profile['img'],false) guiSetVisible(profile['window'],true) end end end ) addEventHandler('onLoginLoad',root, function(name,month,day,year,mail,image) guiSetText(profile['name_memo'],name) guiSetText(profile['birthday_m'],month) guiSetText(profile['birthday_d'],day) guiSetText(profile['birthday_y'],year) guiSetText(profile['mail_memo'],mail) guiStaticImageLoadImage(profile['image'],image) end ) Server-side: --[[ --@@author Draken --@@18-02-2012 ]]-- local table = executeSQLQuery("CREATE TABLE IF NOT EXISTS Profile ( player TEXT, name TEXT, month NUMBER, day NUMBER, year NUMBER, mail TEXT, image TEXT )") addEvent('onPlayerNotLoggedIn',true) addEvent('isPlayerGuest',true) addEvent('onSaveSettings',true) addEvent('onSaveOutput',true) addEvent('onClickSave',true) addEventHandler('isPlayerGuest',root, function() local account = getPlayerAccount(source) if not isGuestAccount(account) then triggerClientEvent('onPanelOpen',source) else triggerEvent('onPlayerNotLoggedIn',source) end end) addEventHandler('onPlayerNotLoggedIn',root, function() outputChatBox("#ABCDEF* #ffffffYou are not logged in!",source,255,255,255,true) end ) addEventHandler('onSaveOutput',root, function() outputChatBox('#ABCDEF* #ffffffYour settings have been saved!',source,255,255,255,true) end ) addEventHandler('onPlayerLogin',root, function (_, account) local result = executeSQLQuery("SELECT * FROM Profile WHERE player = '"..getAccountName(account).."'") if (not result or #result == 0) then executeSQLQuery("INSERT INTO Profile VALUES ( '"..getAccountName(account).."', '', 'Month', 'Day', 'Year', '', '' )") end local resultt = executeSQLQuery("SELECT * FROM Profile WHERE player = '"..getAccountName(account).."'") triggerClientEvent('onLoginLoad',source,tostring(resultt[1]['name']),tostring(resultt[1]['month']),tostring(resultt[1]['day']),tostring(resultt[1]['year']),tostring(resultt[1]['mail']),tostring(resultt[1]['image'])) end ) addEventHandler('onClickSave',root, function(thePlayer,name,month,day,year,mail,image) local update = executeSQLQuery("UPDATE Profile SET name='"..name.."', month='"..month.."', day='"..day.."', year='"..year.."', mail='"..mail.."', image='"..image.."' WHERE player='"..getAccountName(getPlayerAccount(source)).."'") triggerEvent('onSaveOutput',source) end )
-
Hey! I have another problem about this. If I reconnect and I'm logged in it appears but if I logout and login again or restart resource the text not appears anymore Client-side: addEventHandler('onClientGUIClick',root, function() if source == gui['button1_name'] then guiSetVisible(profile['window'],not guiGetVisible(profile['window'])) elseif source == profile['save_label'] then triggerServerEvent('onClickSave',localPlayer,getPlayerName(localPlayer),guiGetText(profile['name_memo']),guiGetText(profile['birthday_m']),guiGetText(profile['birthday_d']),guiGetText(profile['birthday_y']),guiGetText(profile['mail_memo']),getElementData(localPlayer,'Image')) triggerServerEvent('onSaveSettings',localPlayer) elseif source == profile['img_choose'] then guiSetVisible(profile['window'],false) guiSetVisible(profile['img'],true) elseif source == profile['img_select'] then local row, col = guiGridListGetSelectedItem(source) if row and col and row ~= -1 and col ~= -1 then local dir = guiGridListGetItemData(source,row, col) guiStaticImageLoadImage(profile['img_preview'],dir) end elseif source == profile['cancel'] then guiSetVisible(profile['img'],false) guiSetVisible(profile['window'],true) showCursor(true) elseif source == profile['set'] then local row, col = guiGridListGetSelectedItem(profile['img_select']) if row and col and row ~= -1 and col ~= -1 then local dir = guiGridListGetItemData(profile['img_select'],row, col) guiStaticImageLoadImage(profile['image'],dir) setElementData(localPlayer,'Image',dir) guiSetVisible(profile['img'],false) guiSetVisible(profile['window'],true) end end end ) addEventHandler('onLoginLoad',root, function(name,month,day,year,mail,image) guiSetText(profile['name_memo'],name) guiSetText(profile['birthday_m'],month) guiSetText(profile['birthday_d'],day) guiSetText(profile['birthday_y'],year) guiSetText(profile['mail_memo'],mail) guiStaticImageLoadImage(profile['image'],image) end ) Server-side: --[[ --@@author Draken --@@18-02-2012 ]]-- local table = executeSQLQuery("CREATE TABLE IF NOT EXISTS Profile ( player TEXT, name TEXT, month NUMBER, day NUMBER, year NUMBER, mail TEXT, image TEXT )") addEvent('onPlayerNotLoggedIn',true) addEvent('isPlayerGuest',true) addEvent('onSaveSettings',true) addEvent('onSaveOutput',true) addEvent('onClickSave',true) addEventHandler('isPlayerGuest',root, function() local account = getPlayerAccount(source) if not isGuestAccount(account) then triggerClientEvent('onPanelOpen',source) else triggerEvent('onPlayerNotLoggedIn',source) end end) addEventHandler('onPlayerNotLoggedIn',root, function() outputChatBox("#ABCDEF* #ffffffYou are not logged in!",source,255,255,255,true) end ) addEventHandler('onSaveOutput',root, function() outputChatBox('#ABCDEF* #ffffffYour settings have been saved!',source,255,255,255,true) end ) addEventHandler('onPlayerLogin',root, function (_, account) local result = executeSQLQuery("SELECT * FROM Profile WHERE player = '"..getAccountName(account).."'") if (not result or #result == 0) then executeSQLQuery("INSERT INTO Profile VALUES ( '"..getAccountName(account).."', '', 'Month', 'Day', 'Year', '', '' )") end local resultt = executeSQLQuery("SELECT * FROM Profile WHERE player = '"..getAccountName(account).."'") triggerClientEvent('onLoginLoad',source,tostring(resultt[1]['name']),tostring(resultt[1]['month']),tostring(resultt[1]['day']),tostring(resultt[1]['year']),tostring(resultt[1]['mail']),tostring(resultt[1]['image'])) end ) addEventHandler('onClickSave',root, function(thePlayer,name,month,day,year,mail,image) local update = executeSQLQuery("UPDATE Profile SET name='"..name.."', month='"..month.."', day='"..day.."', year='"..year.."', mail='"..mail.."', image='"..image.."' WHERE player='"..getAccountName(getPlayerAccount(source)).."'") triggerEvent('onSaveOutput',source) end )
-
Use my edited dxDrawColorText. You can bring the dx text to front / back and activate/desativate wordbreak and clip. function dxDrawColoredText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end Example: dxDrawColoredText(getPlayerName(thePlayer),posX,posY,width,height,tocolor(255,255,255,255),0.6,"pricedown","center","center",false,false,true)
-
I can use textlibs, but it's more easy for me for big scripts. Then, I made it public. If you don't want to use then don't use
-
Off-topic: I've edited dxDrawColorText and added alignX,alignY,clip,wordbreak and postGUI parameters like dxDrawText. Here: function dxDrawColoredText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end Example: dxDrawColoredText('#ff0000My #00ff00text',posX,posY,width,height,tocolor(r,g,b,a),1.0,"pricedown","left","top",false,false,true) I don't know if someone has done this
-
I don't know why, I'm crazy It worked, Thanks.
-
Sorry. I get no error, onPlayerLogin works fine. Only don't change level to Guest when player logout local uTimers = { } local uTimersLogout = { } addEventHandler('onResourceStart',resourceRoot, function() call(getResourceFromName('scoreboard'),'addScoreboardColumn','Level') setElementData(source,'Level','Guest') end) addEventHandler( 'onPlayerLogin',root, function( ) local account = getPlayerAccount( source ) if account then local level = getAccountData( account ,'My Level' ) or 0 uTimers[ source ] = setTimer( function( thePlayer,account ) local result = executeSQLQuery( "SELECT money FROM Money WHERE player = '"..getPlayerName( thePlayer ).."'" ) if not result or #result == 0 then local create = executeSQLQuery("INSERT INTO Money VALUES ( '"..getPlayerName(thePlayer).."','0')") setAccountData(account,'My Level','Newbie') setElementData(thePlayer,'Level','Newbie') else local money = result[1]['money'] if money <= 50000 then setAccountData( account,'My Level','Newbie' ) setElementData( thePlayer,'Level','Newbie' ) elseif money <= 250000 and tonumber( money ) > 50000 then setAccountData( account,'My Level','Regular' ) setElementData( thePlayer,'Level','Regular' ) elseif money <= 450000 and tonumber( money ) > 250000 then setAccountData( account,'My Level','Experienced' ) setElementData( thePlayer,'Level','Experienced' ) elseif money <= 1000000 and tonumber( money ) > 450000 then setAccountData( account,'My Level','Veteran' ) setElementData( thePlayer,'Level','Veteran' ) elseif money <= 5000000 and tonumber( money ) > 1000000 then setAccountData( account,'My Level','Guru' ) setElementData( thePlayer,'Level','Guru' ) elseif money > 10000000 then setAccountData( account,'My Level','Legend' ) setElementData( thePlayer, 'Level', 'Legend' ) end end end, 500,0,source, account ) --output data if level == 'Newbie' then triggerEvent( 'onNewbieLogin',source ) elseif level == 'Regular' then triggerEvent( 'onRegularLogin',source ) elseif level == 'Experienced' then triggerEvent( 'onExperiencedLogin',source ) elseif level == 'Veteran' then triggerEvent( 'onVeteranLogin',source ) elseif level == 'Guru' then triggerEvent( 'onGuruLogin',source ) elseif level == 'Legend' then triggerEvent('onLegendLogin',source ) end end end ) addEventHandler( 'onPlayerLogout',root, function( ) if isTimer( uTimers [ source ] ) then killTimer( uTimers [ source ] ) end uTimersLogout [ source ] = setTimer ( function( thePlayer ) setElementData( thePlayer,'My Level','Guest' ) end, 500,1,source ) end ) addEventHandler('onPlayerJoin',root, function() setElementData ( source, 'Level', 'Guest' ) end ) addEventHandler('onPlayerQuit',root, function() uTimers[ source ] = nil uTimersLogout[ source ] = nil end )
-
Ty, more one problem. When the player logout, the player level don't sets to Guest. I get expected element at argument 1. I have to kill the uTimers[ source ] timer and set the timer again? Edit: I tried to kill and create a new timer but It don't changes. I don't get any errors now.
-
function( thePlayer,account ) local result = executeSQLQuery( "SELECT money FROM Money WHERE player = '"..getPlayerName( thePlayer ).."'" ) local money = result[1]['money']
-
Hi again! I'm trying to make a Level system now. It works but when a player connect's and logIn I get error "Attempt to concatenate a bolean value". I tried to solve this but I get the error anyway. And, another problem, when the player logOut, the Level in the scoreboard don't change to Guest Here the code: addEventHandler( 'onPlayerLogin',root, function( ) local level = getAccountData(getPlayerAccount(source),'My Level') timer[ source ] = setTimer( function(thePlayer) local account = getPlayerAccount( thePlayer ) local result = executeSQLQuery("SELECT money FROM Money WHERE player= '"..getPlayerName(thePlayer).."'") local money = result[1]['money'] if money <= 50000 then setAccountData( account,'My Level','Newbie' ) setElementData( thePlayer,'Level','Newbie' ) elseif money <= 250000 and tonumber(money) > 50000 then setAccountData( account,'My Level','Regular' ) setElementData( thePlayer,'Level','Regular' ) elseif money <= 450000 and tonumber(money) > 250000 then setAccountData( account,'My Level','Experienced' ) setElementData( thePlayer,'Level','Experienced' ) elseif money <= 1000000 and tonumber(money) > 450000 then setAccountData( account,'My Level','Veteran' ) setElementData( thePlayer,'Level','Veteran' ) elseif money <= 5000000 and tonumber(money) > 1000000 then setAccountData( account,'My Level','Guru' ) setElementData( thePlayer,'Level','Guru' ) elseif money > 10000000 then setAccountData( account,'My Level','Legend' ) setElementData( thePlayer, 'Level', 'Legend' ) end end, 500,0,source ) --output data if level == 'Newbie' then triggerEvent('onNewbieLogin',source) elseif level == 'Regular' then triggerEvent('onRegularLogin',source) elseif level == 'Experienced' then triggerEvent('onExperiencedLogin',source) elseif level == 'Veteran' then triggerEvent('onVeteranLogin',source) elseif level == 'Guru' then triggerEvent('onGuruLogin',source) elseif level == 'Legend' then triggerEvent('onLegendLogin',source) end end) addEventHandler('onPlayerLogout',root, function() timer [ source ] = nil timer [ source ] = setTimer ( function(thePlayer) setElementData(thePlayer,'My Level','Guest') end, 500,1,source) end)
-
Compiled scripts works like uncompiled but you can't edit them. MTA:SA can only read it too. Use any MTA:SA Lua compiler or SciTE ( Lua 5.1 package ).
-
As far as I know, paintjobs is in TXD files ( in model txd files or other txd files in gta sa models folder ).
-
I think it will work. But why you use an infinite timer? function spawnAgain() spawnPlayer( source, 0.0, 0.0, 0.0, 0.0, 0 ) end addEventHandler('onPlayerWasted',root, function() setTimer( spawnAgain, 2000, 1 ) end )
-
timers, event handlers and command handlers functions have to be after the function because the function not exists.
-
local teams = { ['Team name'] = 'Coordinates of spawn like posX,posY,posZ' } gui = guiCreateGridList(posX,posY,Width,Height,relative,parent) column = guiGridListAddColumn(gui,'Teams',1.0) if column then for name, coord in pairs(teams) do local row = guiGridListAddRow(gui) guiGridListSetItemText(gui,row,column,tostring(name),false,false) guiGridListSetItemData(gui,row,column,tostring(coord)) end end See around the forums about team weapons. I don't remember much now.. Out of Computer World
-
Its working perfectly now! Thanks