Jump to content

Spawn*

Members
  • Posts

    21
  • Joined

  • Last visited

About Spawn*

  • Birthday 31/05/1994

Details

  • Location
    Brazil

Spawn*'s Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. SERVER: function CreateAccount(Player, Account, Password) if(addAccount(Account, Password)) then callClientFunction("HideLoginGUI", Player) else outputChatBox("Essa Conta já existe.", Player, 255, 0, 0) end end function callClientFunction(client, funcname, ...) local arg = { ... } if(arg[1])then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end ------------------------------------------------------------------------------------------------------------------------- addEvent("onClientCallsServerFunction", true) ------------------------------------------------------------------------------------------------------------------------- addEventHandler("onClientCallsServerFunction", resourceRoot, callServerFunction) ------------------------------------------------------------------------------------------------------------------------- and CLIENT: function HideLoginGUI() guiSetVisible(rGUI_theBox, not guiGetVisible(rGUI_theBox)) guiSetVisible(rGUI_LbLCon, not guiGetVisible(rGUI_LbLCon)) guiSetVisible(rGUI_LbLSen, not guiGetVisible(rGUI_LbLSen)) guiSetVisible(rGUI_EdtCon, not guiGetVisible(rGUI_EdtCon)) guiSetVisible(rGUI_EdtSen, not guiGetVisible(rGUI_EdtSen)) guiSetVisible(rGUI_BtnLog, not guiGetVisible(rGUI_BtnLog)) guiSetVisible(rGUI_BtnCat, not guiGetVisible(rGUI_BtnCat)) guiSetVisible(rGUI_ImgGUI, not guiGetVisible(rGUI_ImgGUI)) showCursor(false) end function callClientFunction(funcname, ...) local arg = { ... } if(arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end the error appears in the console: bad argument @ 'triggerClientEvent' [Expected element at argument 2, got string 'onServerClassClientFunction' line: triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {}))
  2. The code has not worked, only appeared the message "Erro desconhecido.". So I decided to do a test ... I took the command /register of the system administration and improvised to work on my script-client. RESULT: addCommandHandler ( "register2", function (command, arg1, arg2 ) local username = getPlayerName ( getLocalPlayer() ) local password = arg1 if ( arg2 ) then username = arg1 password = arg2 end if ( password ~= nil ) then if ( string.len ( password ) < 4 ) then outputChatBox ( "register: - Password should be at least 4 characters long", 255, 100, 70 ) elseif ( callServerFunction("addAccount", username, password ) ) then outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", 255, 100, 70 ) outputServerLog ( "ADMIN: "..getPlayerName ( getLocalPlayer() ).." registered account '"..username.."' (IP: "..getPlayerIP(getLocalPlayer()).." Serial: "..getPlayerSerial(getLocalPlayer())..")" ) elseif ( callServerFunction("getAccount", username ) ) then outputChatBox ( "register: - Account with this name already exists.", 255, 100, 70 ) else outputChatBox ( "Unknown Error", 255, 100, 70 ) end else outputChatBox ( "register: - Syntax is 'register [] '", 255, 100, 70 ) end end ) The error was the same ... the only message displayed was "Unknown Error". Now instead of calling a native function with callServerFunction I'll create a function and call it, and inside it put addAccount. Sorry for my bad english. Please help me if you have suggestions
  3. Right, this problem was resolved Now... the code is this: function EventGUICat(button) if button == "left" then local Acct = guiGetText(rGUI_EdtCon) local Pass = guiGetText(rGUI_EdtSen) if(#Acct == 0 or #Pass == 0) then outputChatBox("Digite um nome de Conta não registrado e sua respectiva Senha.", 255, 0, 0) return end if((#Acct ~= 0 and #Acct < 4) or (#Pass ~= 0 and #Pass < 4)) then outputChatBox("O nome de Conta e a Senha devem conter no mínimo 4 caracteres.", 255, 0, 0) return end if(callServerFunction("addAccount", Acct, Pass)) then outputChatBox("Registrado.", 255, 0, 0) showCursor(false) guiSetVisible(rGUI_theBox, not guiGetVisible(rGUI_theBox)) guiSetVisible(rGUI_LbLCon, not guiGetVisible(rGUI_LbLCon)) guiSetVisible(rGUI_LbLSen, not guiGetVisible(rGUI_LbLSen)) guiSetVisible(rGUI_EdtCon, not guiGetVisible(rGUI_EdtCon)) guiSetVisible(rGUI_EdtSen, not guiGetVisible(rGUI_EdtSen)) guiSetVisible(rGUI_BtnLog, not guiGetVisible(rGUI_BtnLog)) guiSetVisible(rGUI_BtnCat, not guiGetVisible(rGUI_BtnCat)) guiSetVisible(rGUI_ImgGUI, not guiGetVisible(rGUI_ImgGUI)) else if(callServerFunction("getAccount", Acct)) then outputChatBox("Conta já existente.", 255, 0, 0) else outputChatBox("Erro desconhecido.", 255, 0, 0) end end end but there is some error... the script is not loaded. This is already becoming too complicated
  4. Oh, sorry! I put the name of script and not the resource hahahaha I'll try
  5. exactly... my resource name is ORP_c and ORP_c HAHAHA
  6. Sorry... I'm not understanding my file acl.xml is in: MTA San Andreas 1.3\servers\mods\deathmatch\acl.xml Ok... I add the lines: <group name="Admin"> <acl name="Moderator"></acl> <acl name="SuperModerator"></acl> <acl name="Admin"></acl> <acl name="RPC"></acl> <object name="resource.admin"></object> <object name="resource.webadmin"></object> <object name="resource.ORP_s"></object> -- here <object name="resource.ORP_c"></object> -- here but still giving that warning
  7. How? You could do an example for me? I'm a beginner and don't understand much of the administration system
  8. addEventHandler("onClientGUIClick", rGUI_BtnCat, EventGUICat, false) function EventGUICat(button) -- some noob code if((callServerFunction("addAccount", Acct, Pass)) ~= false) then showCursor(false) guiSetVisible(rGUI_theBox, not guiGetVisible(rGUI_theBox)) guiSetVisible(rGUI_LbLCon, not guiGetVisible(rGUI_LbLCon)) guiSetVisible(rGUI_LbLSen, not guiGetVisible(rGUI_LbLSen)) guiSetVisible(rGUI_EdtCon, not guiGetVisible(rGUI_EdtCon)) guiSetVisible(rGUI_EdtSen, not guiGetVisible(rGUI_EdtSen)) guiSetVisible(rGUI_BtnLog, not guiGetVisible(rGUI_BtnLog)) guiSetVisible(rGUI_BtnCat, not guiGetVisible(rGUI_BtnCat)) guiSetVisible(rGUI_ImgGUI, not guiGetVisible(rGUI_ImgGUI)) else outputChatBox("Essa conta já existe.", 255, 0, 0) return end end The problem is Access denied @ addAccount in console. Help me please
  9. Yes, the model (ID) 1308 don't work in client-side, only server-side. But in server-side the function "removeWorldModel" only works once as I had said
  10. I replaced 'getRootElement()' by 'resourceRoot' and I have a latest version of MTA (1.3.1, downloaded today) and still doesn't work I changed type for client-side and it worked, but there are some models of objects that can not withdraw, as the 1308 What do you think of this?
  11. Hello! I'm having a serious problem with removeWorldModel ... I'm using a server-side function but if I add it more than once it doesn't work: function sInit() --removeWorldModel(3286, 5, -230.2031, 1185.7734, 23.3516) removeWorldModel(16066, 5, -186.4844, 1217.6250, 20.5625) --removeWorldModel(1352, 5, -206.0703, 1192.9219, 18.7109) setGlitchEnabled("quickreload", false) setGlitchEnabled("fastmove", false) setGlitchEnabled("fastfire", false) exports.scoreboard:addScoreboardColumn("FPS") end addEventHandler("onResourceStart", getRootElement(), sInit) if I use the code as below: removeWorldModel(3286, 5, -230.2031, 1185.7734, 23.3516) removeWorldModel(16066, 5, -186.4844, 1217.6250, 20.5625) --removeWorldModel(1352, 5, -206.0703, 1192.9219, 18.7109) or removeWorldModel(3286, 5, -230.2031, 1185.7734, 23.3516) removeWorldModel(16066, 5, -186.4844, 1217.6250, 20.5625) removeWorldModel(1352, 5, -206.0703, 1192.9219, 18.7109) don't work! I have about 150 objects to remove... The coordinates are accurate, I captured the center of the object in the virtual world! Even if I change the radius doesn' t work! Help me please and sorry for my bad English
  12. I must define it? I thought it was a simple native function like any other
  13. I just started my gamemode, he has absolutely nothing... CLIENT: function callTeste() local rss = getLocalPlayer() callServerFunction("spawnPlayer", rss, 1679.2475, -2286.4585, 13.5290, 270.0) end addCommandHandler("teste_", callTeste) SERVER: function sInit() removeWorldModel(1257, 20000, 0.0, 0.0, 0.0) setGlitchEnabled("quickreload", false) setGlitchEnabled("fastmove", false) setGlitchEnabled("fastfire", false) tPED = createPed(286, 1680.5, -2286.4585, 13.5290, 270.0) end addEventHandler("onResourceStart", getRootElement(), sInit) ------------------------------------------------------------------------------------ function onPlayerEnter() outputChatBox("Bem-vindo ao MTA Freeroam MADE by Spawn*", source, 255, 0, 0, false) spawnPlayer(source, 1679.2475, -2286.4585, 13.5290, 270.0) fadeCamera(source, true) setCameraTarget(source, source) showPlayerHudComponent(source, "money", false) showPlayerHudComponent(source, "clock", false) setPlayerNametagShowing(source, true) giveWeapon(source, 17, 5) giveWeapon(source, 24, 57) giveWeapon(source, 25, 100) giveWeapon(source, 29, 330) bindKey(source, "R", "down", aReload) setPedArmor(source, 100) setPedStat(source, 24, 1000) setElementHealth(source, 175) end addEventHandler("onPlayerJoin", getRootElement(), onPlayerEnter) even with "spawnPlayer" error remains the same (attempt to call global "callServerFuntion" (a nil value))
  14. I copied this example but error still appeared... also I tried to do a test like this: callServerFunction ("spawnPlayer", rss, 0.0, 0.0, 0.0, 270.0) but did not work.
  15. Hi! I'm trying to make this function work for my system of registration and login... CLIENT: function callTeste() local rss = getLocalPlayer() callServerFunction("TestarFunc", rss) end addCommandHandler("teste_", callTeste) SERVER: function TestarFunc(player) outputChatBox("FUNCTION CALLED", player, 255, 0, 0, false) end but unfortunately I can not in any way if debugscript is activated the error that appears is this: attempt to call global "callServerFuntion" (a nil value) Help me please! And sorry for my bad English
×
×
  • Create New...