-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
Draken,Why you not use my code
-
Not tested. function getCurrentClothes( uPlayer ) if isElement( uPlayer ) then local uAccount = getPlayerAccount( uPlayer ) if uAccount and not isGuestAccount( uAccount ) then local sAccount = getAccountName( uAccount ) local tClothes = { } for i = 0,12 do local tResult = executeSQLQuery( "SELECT * FROM clothes WHERE user = '" .. sAccount .. "'" ) if tResult and #tResult > 0 then table.insert( tClothes, { tResult[i].txd, tResult[i].model } ) end end return tClothes end return false end return false end function updateClothes( uPlayer, txd, model ) if isElement( uPlayer ) and type( txd ) == 'string' and type( model ) == 'string' then local uAccount = getPlayerAccount( uPlayer ) if uAccount and not isGuestAccount( uAccount ) then local sAccount = getAccountName( uAccount ) for i = 0,12 do local tRequest = executeSQLQuery( "SELECT * FROM clothes WHERE user = '" .. sAccount .. "'" ) if tRequest and #tRequest > 0 then executeSQLQuery( "UPDATE clothes SET txd = '" .. txd .. "', model = '" .. model .. "' WHERE user = '" .. sAccount .. "'" ) end end return true end return false end return false end addEventHandler( 'onResourceStart', resourceRoot, function( ) executeSQLQuery 'CREATE TABLE IF NOT EXISTS clothes ( user TEXT, txd TEXT, model TEXT )' end ) addEventHandler( 'onPlayerLogin', root, function( _, uAccount ) local tRequest = executeSQLQuery( "SELECT * FROM clothes WHERE user = '" .. getAccountName( uAccount ) .. "'" ) if tRequest and #tRequest > 0 then for i = 0,17 do if tRequest[i].txd and tRequest[i].model then addPedClothes( source, tRequest[i].txd, tRequest[i].model, i ) end end end end ) addEventHandler( 'onPlayerQuit', root, function( ) local uAccount = getPlayerAccount( source ) if uAccount and not isGuestAccount( uAccount ) then local sAccount = getAccountName( uAccount ) for i = 0,17 do local tRequest = executeSQLQuery( "SELECT * FROM clothes WHERE user = '" .. sAccount .. "'" ) local sTxd,sModel = getPedClothes( source, i ) if sTxd and sModel then if tRequest and #tRequest > 0 then executeSQLQuery( "UPDATE clothes SET txd = '" .. txd .. "', model = '" .. model .. "' WHERE user = '" .. sAccount .. "'" ) else executeSQLQuery( "INSERT INTO clothes VALUES ( '" .. sAccount .. "', '" .. txd .. "', '" .. model .. "')" ) end end end end end )
-
Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction element player, not string. In your situation, i think you need use localPlayer Example, client side. addCommandHandler( 'getTeam', function( ) local uTeam = getPlayerTeam( localPlayer ) if uTeam then outputChatBox( 'Your team: ' .. getTeamName( uTeam ) ) else outputChatBox 'Not in team ):' end end )
-
https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Draken, You not add event buyMap and handler. 1 argument is string( not element ), 2 argument is string in function buyMap.
-
1 argument is string not element I said you. Read this too viewtopic.php?f=91&t=40807
-
I mean check this. Conditions and etc. Maybe not exists. Just try.
-
You check conditions with outputChatBox/outputDebugString/... ? Read viewtopic.php?f=91&t=40807 where Logically, a non-working code.
-
What the problem? Can you show, how you trigger event onWins?
-
What you want create in example 1? Explain please. In both codes you replace source with nil in arguments. I more time say you, source not need use in arguments functions - events. Can you read please viewtopic.php?f=91&t=39678
-
compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode ( exports.mapmanager:getRunningGamemode ( ) ) for _, map in pairs( compatibleMaps ) do nubCP = #getElementsByType( 'checkpoint',map ) end Paper, 1 argument is string In function getElementsByType.
-
https://wiki.multitheftauto.com/wiki/Scr ... troduction Learn please! Also read this: viewtopic.php?f=91&t=40809 viewtopic.php?f=91&t=40807
-
RainyLawyer,Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
-
No problem.
-
Blip maybe?
-
local playerAccount = uLastAccount and type( uLastAccount ) == "userdata" and uLastAccount or getPlayerAccount( source ) It's better. If you not see. You think it wrong? For you. local var = 0 return var == 0 and 'ye' or 'bad' --> ye Also local var = 0 return var == 0 --> true ( If not, it return false. )
-
Oh ye, little mistake. You can create only one condition. if not isGuestAccount( playerAccount ) then It's better function changeTheSkin( source ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then for i = 0,17 do local arg1,arg2 = getPedClothes( source, i ) setAccountData( playerAccount, "player.clothes."..tostring( i ),tostring( arg1 )..","..tostring( arg2 ) ) end setAccountData( playerAccount, "player.skin", getElementModel( source ) ) outputChatBox("#FF0000*INFO: #0095FFYour skin was successfully saved!", source, 0, 255, 0, true) end end function fLogout ( uLastAccount ) local playerAccount = uLastAccount and type( uLastAccount ) == "userdata" and uLastAccount or getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerMoney = getPlayerMoney( source ) --local nSkin = getElementModel( source ) setAccountData( playerAccount, "player.money", playerMoney ) --setAccountData( playerAccount, "player.skin", nSkin ) for i = 1,12 do setAccountData ( playerAccount, "player.weaponID" .. tostring( i ), getPedWeapon ( source, i ) ) setAccountData ( playerAccount, "player.weaponAmmo" .. tostring( i ), getPedTotalAmmo ( source, i ) ) end end end addEventHandler( 'onPlayerLogout', root, fLogout ) addEventHandler( 'onPlayerQuit', root, fLogout ) addCommandHandler( "skinsave", changeTheSkin ) addEventHandler( "onPlayerWasted", root, function( ) local playerAccount = getPlayerAccount( source ) if playerAccount and not isGuestAccount( playerAccount ) then local playerSkin = getAccountData( playerAccount, "player.skin" ) if playerSkin then spawnPlayer( 2155, -99, 3, 0, math.random( 0, 258 ),tonumber( playerSkin ) ) else spawnPlayer( 2155, -99, 3, 0, math.random( 0, 258 ) ) end end end ) addEventHandler( "onPlayerLogin", root, function( ) local playerAccount = getPlayerAccount( source ) if playerAccount then for i = 1,12 do local nWeapon = getAccountData ( playerAccount, "player.weaponID" ..tostring( i ) ) local nAmmo = getAccountData ( playerAccount, "player.weaponAmmo" ..tostring( i ) ) giveWeapon( source, tonumber( nWeapon ), tonumber( nAmmo ), tonumber ( nWeapon ) == 1 ) end local playerMoney = getAccountData( playerAccount, "player.money" ) setPlayerMoney( source, playerMoney ) local playerSkin = getAccountData( playerAccount, "player.skin" ) if playerSkin then setElementModel( source, playerSkin ) for i = 0,17 do local acc = getAccountData( playerAccount, 'player.clothes.'..i ) if not acc:find 'false' then addPedClothes( source,acc:sub( 1,acc:find( ',' ) - 1 ),acc:sub( acc:find( ',' ) + 1,acc:len( ) ),i ) end end end end end )
-
Can you write what you change? Like comments.
-
addEventHandler("onClientGUIClick", GUIEditor_Button[1], guiSetVisible, GUIEditor_Window[1], false) Mal. Los argumentos de 3 a 5 incorrecta.
-
Evil-Cod3r,You lol. I say you more time
-
viewtopic.php?f=91&t=40807 I mean make the code refactoring.