-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
function onResourceStart () call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Online Time") for index, player in pairs ( getElementsByType("player") ) do setElementData (player, "joinTime", getTickCount() ) setElementData (player, "Online Time", "0 :, 0 :, 0 :" ) end end addEventHandler("onResourceStart",resourceRoot,onResourceStart) function joinTime () setElementData ( source, "joinTime", getTickCount() ) setElementData ( source, "Online Time", "0 :, 0 :, 0 :" ) end addEventHandler ( "onPlayerJoin", root, joinTime ) function all() for index , player in ipairs ( getElementsByType ( "player" ) ) do local s = getElementData( player, "joinTime" ) or getTickCount( ) s = ( getTickCount() - s ) / 1000 local string = string.format( "%02d:%02d:%02d", s/3600, s%3600/60, s%60 ) setElementData( player, "Online Time", string ) end end setTimer( all, 1000, 0) function saveTime( player, account ) if ( account and not isGuestAccount(account) ) then local OnlineTime = getElementData( player, "joinTime" ) setAccountData(account, "OnlineTime", OnlineTime) end end addEventHandler ( "onPlayerLogout", root, function ( prev ) saveTime( source, prev ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) saveTime( source, getPlayerAccount( source ) ) end ) addEventHandler ( "onPlayerLogin", root, function ( _, account ) local OnlineTime = getAccountData( account, "Online Time" ) if ( not OnlineTime ) then OnlineTime = 0 end setElementData( source, "joinTime", OnlineTime ) end ) Your problem(s) we're: 1: You can't make a variable with spaces, e.g: Online Time = "hello world", it has to be: OnlineTime = "hello world". 2: You we're saving the time string, not the milliseconds. 3: It still won't work though, when you login back, it'll set it to 9 hours and something.
-
1): Lo que estas pidiendo es un sistema de personajes, no es muy facil de hacer para un novato (sin ofender). 2): Yo cree un recurso hace un tiempo, es un sistema de niveles con experiencia, y agregue un ejemplo a la descripcion para usarlo con los zombies de slothman. Link de descarga: https://community.multitheftauto.com/index.php?p= ... ls&id=1253
-
Si realmente queres aprender, vas a tener que estudiar Ingles, porque la wiki esta muy poco traducida.
-
@Soren: En mi opinion el deberia empezar a aprender, porque si le damos el script ya hecho, simplemente no aprendera.
-
Have you tested my code?
-
Usa la funcion aclGroupAddObject para agregar objetos a un grupo de ACL.
-
Las contraseñas estan codificadas con MD5.
-
function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox)
-
Check the script, if it's readable then it's not compiled.
-
I'm not sure if he want's that, but well, let's wait and see who was right . And yes, I do know what's the difference, do you think I'm stupid?
-
Where? If I'm right, he want's the player to be able to show/hide players.
-
You're welcome .
-
iv = 0 function invis() for index, player in ipairs(getElementsByType("player")) do if (player ~= localPlayer) then if (iv == 0) then iv = 1 setPlayerNametagShowing(player, false) setElementAlpha(player, 0) else iv = 0 setPlayerNametagShowing(player, true) setElementAlpha(player, 255) end end end end bindKey("F1","down",invis)
-
local amount = 1000 function giveMoney(thePlayer) for index, player in ipairs(getElementsByType("player")) do if (player ~= thePlayer) then givePlayerMoney(player, amount) outputChatBox(getPlayerName(thePlayer) .." gave you $".. amount .."!",player,0,255,0) end end end addCommandHandler("giveallcash",giveMoney)
-
Have you even tested my script? it'll do that.
-
That command will give everyone but you the X amount of money.
-
function giveMoney(thePlayer, cmd, amount) local amount = tonumber(amount) if (amount) then for index, player in ipairs(getElementsByType("player")) do if (player ~= thePlayer) then givePlayerMoney(player, amount) outputChatBox(getPlayerName(thePlayer) .." gave you $".. amount .."!",player,0,255,0) end end end end addCommandHandler("givecash",giveMoney) Do you mean that?
-
I wouldn't be here if it wasn't that kind of forum .
-
Is the script he sent you non compiled? if so, then post it here.
-
But that function isn't available until MTA 1.3.1 onwards.
-
You're welcome.
-
It's still wrong. function saveTime(player, account) if (account and not isGuestAccount(account)) then local joinTime = getElementData(player,"joinTime") setAccountData(account,"joinTime",joinTime) end end addEventHandler("onPlayerLogout",root, function (prev) saveTime(source, prev) end ) addEventHandler("onPlayerQuit",root, function () saveTime(source, getPlayerAccount(source)) end ) That should get the element data "joinTime" from the player when he logs out or leaves the server, and save it on player account. This won't load it, I leave that to you.
-
You mean your "friend" gave you a login panel which has a backdoor?
-
Maybe you can do a function to check when a new resource is loaded, e.g: comparing a table with current resources.