-
Posts
314 -
Joined
-
Last visited
Everything posted by gokalpfirat
-
Where can i download it?
-
Yes I dont do because first I want to learn how to use table.insert with this code
-
this is rest of the code you see anything that arent writing?
-
server.lua Tags = { {"%[HW%]", "Holy Warriors", "#50B200", nil} } addEvent ( "addClan", true ) addEventHandler ( "addClan", root, function ( tag,name,color ) table.insert(Tags,{tag,name,color,nil}) end ) client.lua myWindow = guiCreateWindow ( 0.3, 0.3, 0.4, 0.6, "Clan Ekle", true ) guiCreateLabel(0.1,0.2,0.4,0.6,"Tag",true,myWindow) editBox = guiCreateEdit( 0.3, 0.2, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.4,0.4,0.6,"Clan Adı",true,myWindow) editBox1 = guiCreateEdit( 0.3, 0.4, 0.4, 0.05, "", true,myWindow ) guiCreateLabel(0.1,0.6,0.4,0.6,"Renk Kodu",true,myWindow) editBox2 = guiCreateEdit( 0.3, 0.6, 0.4, 0.05, "", true,myWindow ) button = guiCreateButton( 0.35, 0.8, 0.2, 0.1, "Ekle", true,myWindow ) showCursor(true) function outputEditBox () local tag = guiGetText ( editBox ) local name = guiGetText ( editBox1 ) local color = guiGetText ( editBox2 ) triggerServerEvent ( "addClan", getLocalPlayer(), tag,name,color ) end addEventHandler ( "onClientGUIClick", button, outputEditBox ) It wont adds to table.
-
local r, g, b = getPlayerNametagColor ( player ) You can use this.
-
It works perfectly I try I dont understand what do you want a login system? Login systems gui is nice when I start it gives your gui and cursor.
-
You add every function this why? triggerClientEvent ( "onWin", getRootElement(), activePlayers[1] )
-
text = guiCreateLabel(0.5,0.5,0.5,0.5,"Test",true) guiLabelSetColor(text,255,0,0) GuiLabelSetColor
-
Kchaticon resource gives this error everytime. WARNING: chaticon\ktypestatus_cl.lua:59: Bad argument @ 'guiSetPosition' [Expected number at argument 2, got boolean] local showMyIcon = true local chattingPlayers = {} local drawDistance = 1000 local transicon = false local chatIconFor = {} local screenSizex, screenSizey = guiGetScreenSize() local guix = screenSizex * 0.1 local guiy = screenSizex * 0.1 local globalscale = 1 local globalalpha = .85 addEvent("updateChatList", true ) gChatting = false function chatCheckPulse() local chatState = isChatBoxInputActive() or isConsoleActive() if chatState ~= gChatting then if chatState then triggerServerEvent("playerChatting", getLocalPlayer()) else triggerServerEvent("playerNotChatting", getLocalPlayer()) end gChatting = chatState end setTimer( chatCheckPulse, 250, 1) end function showTextIcon() local playerx,playery,playerz = getElementPosition ( getLocalPlayer() ) for player, truth in pairs(chattingPlayers) do if (player == getLocalPlayer()) then if(not showMyIcon) then return end end if(truth) then local chatx, chaty, chatz = getElementPosition( player ) if(isPlayerInVehicle(player)) then chatz = chatz + .5 end local dist = getDistanceBetweenPoints3D ( playerx, playery, playerz, chatx, chaty, chatz ) if dist < drawDistance then if( isLineOfSightClear(playerx, playery, playerz, chatx, chaty, chatz, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( chatx, chaty, chatz+1.2 ) local scaled = screenSizex * (1/(2*(dist+5))) *.85 local relx, rely = scaled * globalscale, scaled * globalscale -- -.0025 * dist+.125 --if(dist < 1) then -- relx, rely = guix, guiy --end guiSetAlpha(chatIconFor[player], globalalpha) guiSetSize(chatIconFor[player], relx, rely, false) guiSetPosition(chatIconFor[player], screenX, screenY, false) if(screenX and screenY) then guiSetVisible(chatIconFor[player], true) end end end end end end function updateList(newEntry, newStatus) chattingPlayers[newEntry] = newStatus if(not chatIconFor[newEntry]) then chatIconFor[newEntry] = guiCreateStaticImage(0, 0, guix, guiy, "chat.png", false ) end guiSetVisible(chatIconFor[newEntry], false) end function toggleIcon() outputChatBox ( "Your icon is: " ) if( showMyIcon ) then showMyIcon = false outputChatBox ( "off", 255, 0, 0) else showMyIcon = true outputChatBox ( "on", 0, 255, 0) end end function resizeIcon( command, newSize ) if(newSize) then local resize = tonumber( newSize ) local percent = resize/100 globalscale = percent end outputChatBox("Chat icons are "..(globalscale * 100).."% normal size") end function setIconAlpha( command, newSize ) if(newSize) then globalalpha = tonumber( newSize ) / 100 end outputChatBox("Chat icons are "..(globalalpha * 100).."% visible") end addEventHandler ( "updateChatList", getRootElement(), updateList ) addEventHandler ( "onClientResourceStart", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientPlayerJoin", getRootElement(), chatCheckPulse ) addEventHandler ( "onClientRender", getRootElement(), showTextIcon ) addCommandHandler( "toggleicon", toggleIcon) addCommandHandler( "resizeicon", resizeIcon) addCommandHandler( "seticonvis", setIconAlpha)
-
exports.scoreboard:addScoreboardColumn('PlayTime') local t = { } addEventHandler( 'onResourceStart', resourceRoot, function( ) executeSQLQuery( 'CREATE TABLE IF NOT EXISTS SerialData ( serialPlayer TEXT, key STRING, value TEXT )' ) end ) aType = { [ 'number' ] = true ; [ 'string' ] = true ; } function setPlayerSerialData( player, key, value ) if not isElement( player ) then return end if type( key ) == 'string' and aType[ type( value ) ] then if getPlayerSerialData( player, key ) then executeSQLQuery( 'UPDATE SerialData SET serialPlayer = ?, key = ?, value = ?', getPlayerSerial( player ), key, value ) return true else executeSQLQuery( 'INSERT INTO SerialData( serialPlayer, key, value ) VALUES( ?, ?, ? )', getPlayerSerial( player ), key, value ) return true end end end function getPlayerSerialData( player, key ) if not isElement( player ) then return end if type( key ) == 'string' then result = executeSQLQuery( 'SELECT value FROM SerialData WHERE key = ? AND serialPlayer = ?', key, getPlayerSerial( player ) ) end if result and type( result ) == 'table' and #result > 0 then if result[ 1 ][ 'value' ] then return result[ 1 ][ 'value' ] else return false end end return false end function removePlayerSerialData( player, key ) if not isElement( player ) then return end if type( key ) == 'string' then if getPlayerSerialData( player, key ) then executeSQLQuery( 'DELETE FROM SerialData WHERE key = ? AND serialPlayer = ?', key, getPlayerSerial( player ) ) return true end end end function getAllPlayerSerialData( player ) if not isElement( player ) then return end if type( key ) == 'string' then aResult = executeSQLQuery( 'SELECT * FROM SerialData WHERE serialPlayer = ?', getPlayerSerial( player ) ) end if aResult and type( aResult ) == 'table' and #aResult > 0 then return aResult[ 1 ] else return false end return false end function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function onPlayerQuit ( ) local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setPlayerSerialData (source, "PlayTime-hour", tostring(hour) ) setPlayerSerialData (source, "PlayTime-min", tostring(min) ) setPlayerSerialData (source, "PlayTime-sec", tostring(sec) ) setPlayerSerialData (source, "PlayTime", tostring(sValue) ) t[ source ] = nil end function onPlayerJoin ( ) if ( playeraccount ) then local time = getPlayerSerialData(source,"PlayTime") local hou = getPlayerSerialData(source,"PlayTime-hour") local min = getPlayerSerialData(source,"PlayTime-min") local sec = getPlayerSerialData(source,"PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setPlayerSerialData (source, "PlayTime", 0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) When i quit and join again it wont saves.
-
How can list values from bigger to lower in sql lite and get first 5 values. In MYSQL it is too easy but I want to know how in SQL Lite.
-
function weaponAttach (source, commandName ) weapon3 = createWeapon ( "M4",0,0,0 ) weapon4 = createWeapon ( "M4",0,0,0 ) attachElements ( weapon3, source, 5, 0, 0 ) attachElements ( weapon4, source, 0, 5, 0 ) end addCommandHandler( "attachweapons", weaponAttach )
-
Isn't' createWeapon function in MTA 1.4?
-
Is this will set the original handling values to car. I shouldn't use getOrginalHandling
-
Yes i know but i want to make this to all vehicles with loop. Otherwise I can do it with a lot of lines.
-
Hi guys. I want set all cars handling to their originals. I can make it with a lot of lines but I dont want to make there. I havent do a lot of scripts with "for k,v in pairs(h)" like loops. How can i make. I know that I should use theese functions. getOriginalHandling setModelHandling
-
The (SELECT @curRank := 0) part allows the variable initialization without requiring a separate SET command.
-
database = mysql_connect( "localhost", "root", "ankara", "test1" ) -- connectDB if database then outputDebugString ('Connect') else outputDebugString ("Trouble") end result = mysql_query(database, "SELECT first_name, age, gender, @curRank := @curRank + 1 AS rank FROM person p, (SELECT @curRank := 0) r ORDER BY age; ") -- Execute the query if result then outputDebugString ('True') else outputDebugString ("False") end It always says True at debugscipt but when I look at mysql table it wont happens. (Note: When I execute this at phpmyadmin it works. But when i execute it at mta it wont.)
-
Sorry for flooding but waiting.
-
Find this at race_client.lua function kill() if Spectate.active then if Spectate.savePos then triggerServerEvent('onClientRequestSpectate', g_Me, false ) end else Spectate.blockManual = true triggerServerEvent('onRequestKillPlayer', g_Me) Spectate.blockManualTimer = setTimer(function() Spectate.blockManual = false end, 3000, 1) end end addCommandHandler('kill',kill) addCommandHandler('Commit suicide',kill) bindKey ( next(getBoundKeys"enter_exit"), "down", "Commit suicide" )
-
In race I think in race_server there was a bind Key for enter you should look.
-
Now you are talking at Global Forum that everyone speaks English. Try to find your country's language forum at there viewforum.php?f=117
-
Why you need always example in all your topics. Only change the code at your first message.