-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Bajate un programa llamado "notepad++" y desde ahi abris los archivos y le cambias la codificacion ( no se si dira "Codificacion" en el menu del notepad++, es el quinto menu ).
-
You had forgot to hide it after create it, copy the code again.
-
All client side: GUIEditor = { button = {}, label = {}, window = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() Window = guiCreateWindow(385, 158, 478, 385, "Buy A Vehicle", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(26, 98, 326, 34, "Infernous : $30000", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "sa-header") bBuy = guiCreateButton(373, 108, 86, 29, "BUY", false, GUIEditor.window[1]) end ) local buyVeh = createMarker(1940.5185546875, -1707.1162109375, 13.3828125, "cylinder", 1.5, 255, 255, 0, 170) function showGUIp(hitPlayer) if ( hitPlayer == localPlayer ) then setElementFrozen ( localPlayer, true ) guiSetVisible ( Window, true ) showCursor ( true ) end end addEventHandler ( "onClientMarkerHit", buyVeh, showGUIp )
-
Create an event server side, then trigger it from the client.
-
Ese mensaje quiere decir que esta usando una codificacion vieja, cambiala a "UTF-8".
-
When you take money client side, it won't sync with the server side, so it won't really take it, it has to be server side.
-
You're welcome.
-
showFishignArea = createRadarArea ( 3122.1650390625, -2894.99829, 10000, 10000, 0, 255, 255, 100 ) fishingArea = createColRectangle ( 3122.1650390625, -2894.99829, 10000, 10000 ) fishingAllowed = { } local fishTimes = { {4000}, {4000}, {4000}, {4000}, {6000}, {8000}, {8000}, {8000}, {8000}, {8000}, {8000}, {8000}, {8000}, {10000}, {10000}, {10000}, {10000}, {10000}, {2000}, {2000}, {2000}, {2000}, {2000}, {2000}, {12000}, {12000}, {12000}, {12000}, {12000}, {12000}, {12000}, } local fishAmount = { {100}, {100}, {100}, {100}, {100}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {110}, {120}, {120}, {120}, {120}, {120}, {120}, {120}, {120}, {120}, {120}, {120}, {130}, {130}, {130}, {130}, {130}, {130}, {130}, {130}, {130}, {130}, {140}, {150}, {160}, {170}, {180}, {190}, {200} } payTimers = { } function unpackTimes() return unpack(fishTimes[math.random(#fishTimes)]) end function unpackAmounts() return unpack(fishAmount[math.random(#fishAmount)]) end addCommandHandler ( "startfish", function(player) fishing = true local timer = unpackTimes() if (getElementData(player, "Class") == "Fisherman") then if (fishingAllowed [ player ]) then setPedAnimation ( player, "SWORD", "sword_IDLE") payTimers [ player ] = setTimer ( payPlayer, timer, 0, player ) end end end ) addCommandHandler ( "stopfish", function(player) ---Required Arguments player fishing = false setPedAnimation(player,false) if isTimer(payTimers [ player ]) then killTimer(payTimers [ player ]) payTimers [ player ] = nil end end ) function payPlayer(player) local amount = unpackAmounts() givePlayerMoney( player, amount ) resetTimer ( payTimers [ player ] ) end addEventHandler ( "onColShapeHit", fishingArea, function( thePlayer ) if getElementType ( thePlayer ) == "player" then fishingAllowed [ thePlayer ] = true end end ) addEventHandler ( "onColShapeLeave", fishingArea, function( thePlayer ) if getElementType ( thePlayer ) == "player" then fishingAllowed [ thePlayer ] = false end end ) --Anti-AFK function afkCancler(player) if (fishing) then outputChatBox("You Have Been Automatically Stopped Recieving Fish To Prevent Afking, Please Do The Command Again To Start Again!!", source) setPedAnimation(source,false) if isTimer(payTimers [ player ]) then killTimer(payTimers [ player ]) payTimers [ player ] = nil end end end setTimer( afkCancler, 600000, 0 )
-
This will remove HEX codes from the name. local root = getRootElement() local timers = {} --[[ -- check Nick -- -- Checks if the nick currently used by the given player -- is protected and if he is allowed to use it. -- -- @param player player: The player whose nick should be checked -- @return -- ]] function checkNick(player) -- player changed nick, just joined or timer ran out (possible running timer is no longer necessary) killTimerForPlayer(player) -- fetch information about the player's nick local nick = getPlayerName(player) if isPlayerAllowedToUseNick(player,nick) then return end -- # nick is protected and player has (currently) no right to use it --outputDebugString("tell player "..getPlayerName(player).." to login or change nick") local secondsForLogin = tonumber(get("timeForLogin")) if toboolean(get("useTextDisplays")) then warnPlayer(player,"Your nick '"..nick.."' is protected. Please login or change nick within "..secondsForLogin.." seconds.") end outputMessage("Your nick '"..nick.."' is protected. Please login or change nick within "..secondsForLogin.." seconds.",player,0) timers[player] = setTimer(checkNickAgain,secondsForLogin*1000,1,player) end --[[ -- checkNickAgain -- -- Called by the timer to check if the player is now allowed to use the nick, -- or otherwise take action. -- -- @param player player: The Player -- @return -- ]] function checkNickAgain(player) if isPlayerAllowedToUseNick(player,getPlayerName(player)) then return end if toboolean(get("changeNickInsteadOfKicking")) then changeNickToRandom(player) if toboolean(get("useTextDisplays")) then warnPlayer(player,"Your nick has been changed because you used a protected nick.") end outputMessage("Your nick has been changed because you used a protected nick.",player,0) else kickPlayer(player,"Used protected nick.") end outputDebugString("take action on "..getPlayerName(player).." (change nick or kick)") end --[[ -- changeNickToRandom -- -- Creates a random nick which is not currently used and sets it as -- new nick for the given player. -- -- @param player player: The player who's nick should be changed. -- @return -- ]] function changeNickToRandom(player) local randomNick = "Player"..math.random(100,999) while getPlayerFromName(randomNick) do randomNick = "Player"..math.random(100,999) end setPlayerName(player,randomNick) end --------------------------------------------------- -- ### Getting and modifying data from the database --------------------------------------------------- --[[ -- getProtectedNickData -- -- Gets the data for a protected nick from the database -- -- @param string nick: The nick you want to get the data from -- @return mixed false/result: Returns either false if no result was found or a table with the desired data -- ]] function getProtectedNickData(nick) local result = executeSQLQuery("SELECT *, ((JULIANDAY('now') - JULIANDAY(lastUsed))) AS lastUsedDaysPassed FROM nickProtection WHERE protectedNick = ?",nick) if #result == 0 then return false end return result[1] end --[[ -- removeExpiredNicks -- -- Removes expired nicks (depending on the mode set in the settings) -- ]] function removeExpiredNicks() local expireMode = tonumber(get("protectedNicksExpireMode")) if expireMode == 0 then return end local expiresAfterDays = tonumber(get("protectedNicksExpireAfterDays")) local expiredNicks = executeSQLQuery("SELECT rowid, * FROM nickProtection WHERE (JULIANDAY('now') - JULIANDAY(lastUsed)) > ?",expiresAfterDays) for k,v in ipairs(expiredNicks) do local accountString = "user."..v.accountName if expireMode == 2 or not hasObjectPermissionTo(accountString,"resource.nickProtection.extended",false) then outputDebugString("Removing expired nick: "..tostring(v.protectedNick).." (last used "..tostring(v.lastUsed)..")") executeSQLQuery("DELETE FROM nickProtection WHERE rowid = ?",v.rowid) end end end --[[ -- updateLastUsed -- -- Updates the lastUsed field when the nick is used. -- -- @param string nick: The nick. -- ]] function updateLastUsed(nick) executeSQLQuery("UPDATE nickProtection SET lastUsed = DATETIME('now') WHERE protectedNick = ?",nick) end --[[ -- isNickProtected -- -- Checks if the given nick is protected by someone. -- -- @param string nick: The nick that should be checked. -- @return boolean true/false -- ]] function isNickProtected(nick) local data = getProtectedNickData(nick) if not data then return false end return true end --[[ -- getProtectedNicksByAccountName -- -- Returns a table with protected nicks associated with the given account name. -- -- @param string accountName: The name of the account, e.g. "Adnan" -- @return table protectedNicks: A table of protected nicks (could also contain no elements at all) -- ]] function getProtectedNicksByAccountName(accountName) local protectedNicks = executeSQLQuery("SELECT *, ((JULIANDAY('now') - JULIANDAY(lastUsed))) AS lastUsedDaysPassed FROM nickProtection WHERE accountName = ?",accountName) return protectedNicks end --[[ -- isPlayerAllowedToUseNick -- -- Checks if the player is allowed to use the given nick, -- so if it is protected at all and if the player is the one -- who protected it. -- -- @param player player: The player who claims ownership of the nick -- @param string nick: The nick who should be checked -- @return boolean true/false -- ]] function isPlayerAllowedToUseNick(player,nick) local data = getProtectedNickData(nick) if data == false then return true end -- if player is logged in to the required account, return local playerAccountName = getAccountName(getPlayerAccount(player)) if data.accountName ~= nil and data.accountName == playerAccountName then -- consider nick used, when the rightful owner tried to take it updateLastUsed(nick) return true end return false end -------------------- -- ### Player Events -------------------- --[[ -- playerJoined -- -- Simply calls checkNick() as soon as a player joins. -- ]] function playerJoined() checkNick(source) end addEventHandler("onPlayerJoin",root,playerJoined) --[[ -- playerLeft -- -- Clears up when a player leaves the server. For now it only kills -- the timer (if necessary). -- ]] function playerLeft() killTimerForPlayer(source) end addEventHandler("onPlayerQuit",root,playerLeft) --[[ -- playerChangedNick -- -- Checks on change of nick if the player is allowed to use the new nick. -- If so, nickChangeSpamProtection is also called if enabled. -- -- Event Handler for onPlayerChangeNick. -- -- @param string oldNick: The nick previously used -- @param string newNick: The nick the player wants to change to -- @return -- ]] function playerChangedNick(oldNick,newNick) if isPlayerAllowedToUseNick(source,newNick) then killTimerForPlayer(source) -- check for nick spam if enabled if toboolean(get("enableNickChangeSpamProtection")) then nickChangeSpamProtection(source) end
-
Vos no lo creaste, ese recurso es publico.
-
My public gang system now has gang color selector.
-
Usa setAccountData para borrar la informacion de la cuenta ( como te dije por PM hace dias ).
-
Try this and see what it outputs to chat: function oncolehit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then local pname = getPlayerName ( thePlayer ) local veh = getPedOccupiedVehicle ( thePlayer ) local seat = getPedOccupiedVehicleSeat ( thePlayer ) if ( veh ) and ( seat == 0 ) then local qh = dbQuery ( handler2, "SELECT * FROM accounts WHERE Name = '".. pname .."'" ) local result, num_affected_rows, errmsg = dbPoll ( qh, -1 ) outputChatBox ( "Rows: ".. tostring ( num_affected_rows ) ) if ( result and type ( result ) == "table" and result [ 1 ] ) then if ( result [ 1 ] [ "Wert" ] == "1" ) then outputChatBox ( "Danke das du das Parkhaus besuchst!", thePlayer, 0, 255, 0 ) eschrankefunc ( ) else triggerClientEvent ( thePlayer, "openGUI", thePlayer, veh, pname ) end end end end end addEventHandler ( "onColShapeHit", cole, oncolehit )
-
Is "Wert" data set to "1"? also, seems like "result" is not returning what it should.
-
Try copying it again.
-
Which line is that? because that script only has 20 lines.
-
With Mr.Pres[T]ege's script it'll only bind the key to the one who hit it.
-
Use this then: -- local mark1 = guiCreateStaticImage( 0.52, 0.51, 0.035, 0.035, 'blip.png', true, map ) -- -- addEventHandler ( 'onClientGUIClick', guiRoot, function ( ) if ( source == mark1 ) then guiSetVisible ( windowMap, false ) showCursor ( false ) elseif ( source == mark2 ) then ... elseif ( source == mark3 ) then ... end end ) Unless you want to hide 'windowmap' when you click on several buttons, then you can do: addEventHandler ( 'onClientGUIClick', guiRoot, function ( ) if ( source == mark1 or source == mark2 or source == mark3 ) then guiSetVisible ( windowMap, false ) showCursor ( false ) end end )
-
-- local mark1 = guiCreateStaticImage( 0.52, 0.51, 0.035, 0.035, 'blip.png', true, map ) -- -- addEventHandler ( 'onClientGUIClick', mark1, function ( ) guiSetVisible ( windowMap, false ) showCursor ( false ) end ,false ) Try that.
-
Try this: function oncolehit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then local pname = getPlayerName ( thePlayer ) local veh = getPedOccupiedVehicle ( thePlayer ) local seat = getPedOccupiedVehicleSeat ( thePlayer ) if ( veh ) and ( seat == 0 ) then local qh = dbQuery ( handler2, "SELECT * FROM accounts WHERE Name = '".. pname .."'" ) local result, num_affected_rows, errmsg = dbPoll ( qh, -1 ) if ( result and type ( result ) == "table" and result [ 1 ] ) then if ( result [ 1 ] [ "Wert" ] == "1" ) then outputChatBox ( "Danke das du das Parkhaus besuchst!", thePlayer, 0, 255, 0 ) eschrankefunc ( ) else triggerClientEvent ( thePlayer, "openGUI", thePlayer, veh, pname ) end end end end end addEventHandler ( "onColShapeHit", cole, oncolehit )
-
ERROR AL ENTRAR AL SV
Castillo replied to PhantomDamn's topic in Ayuda relacionada al cliente/servidor
Osea que ya funciona? -
Why it doesn't work? any errors?