Jump to content

Hyunsu_Oh

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Hyunsu_Oh

  1. sorry, my bad english. SetPlayerWeather functions is to samp. This function is applied only one person only. There are MTA also like this functions?
  2. thank 50p, gamesnert It helps always and it thanks.
  3. sorry, my bad english.. It removes how? ex) When inputting "/login ", When the name is changed, When the player connects, .... please help me!!
  4. "xmlLoadFile" should to do only once in one file?
  5. GRoot = getRootElement() GRRoot = getResourceRootElement() UserFolderName = "UserFolder" function OnModeStart(startedmode) SecondTimerAddress = setTimer(SecondTimer, 1000, false) end function OnPlayerJoin() ResetPlayerValue(source) fadeCamera(source, true) SpawnPlayer(source) setCameraTarget(source, source) ClearChatBox(source) end function OnPlayerTarget(targetelement) end function OnPlayerSpawn() setElementPosition ( source, 100, 100, 20) end function OnPlayerWasted(ammo, killerelement, weapon, bodypart) setTimer(SpawnPlayer, 5000, 1, source) end function OnPlayerDamage(attackerelement, weapon, bodypart, damage) end function OnPlayerChat(message, messageType) cancelEvent() outputChatBox("[Player] ".. getPlayerName(source) .. " : " .. message) end addEventHandler("onResourceStart", GRRoot, OnModeStart) addEventHandler("onPlayerTarget", GRoot, OnPlayerTarget) addEventHandler("onPlayerJoin", GRoot, OnPlayerJoin) addEventHandler("onPlayerSpawn", GRoot, OnPlayerSpawn) addEventHandler("onPlayerWasted", GRoot, OnPlayerWasted) addEventHandler("onPlayerDamage", GRoot, OnPlayerDamage) addEventHandler("onPlayerChat", GRoot, OnPlayerChat) function consoleCheckParameters ( playerSource, commandName, ... ) local parametersTable = {...} local parameterCount = #parametersTable outputChatBox ( "Number of parameters: " .. parameterCount, playerSource ) local stringWithAllParameters = table.concat( parametersTable, ", " ) outputChatBox ( "Parameters passed: " .. stringWithAllParameters, playerSource ) end function RegisterPlayer(playerSource, commandName, id, password) if GetPlayerValue(playerSource, "Registered") then outputChatBox ("이미 가입 하셨습니다. 로그인 해주세요.", playerSource ) return end local UFN = GetUserFileName(id) if IsXmlCreated(UFN) then outputChatBox ("이미 이 아이디는 생성 되있습니다.", playerSource ) else local thenode = xmlCreateFile (UFN, "UserData") if thenode then xmlNodeSetValue (thenode, password) xmlCreateChild (thenode, "Info") xmlSaveFile(thenode) xmlUnloadFile(thenode) outputChatBox ("성공적으로 아이디가 생성되었습니다.", playerSource ) SetPlayerValue(playerSource, "Registered", true) setTimer(SavePlayer, 3000, 1, playerSource, id) else outputChatBox ("계정생성중 오류가 발생하였습니다.", playerSource ) outputChatBox ("[아이디는 영어로 해주세요]", playerSource ) end end end function LoginPlayer(playerSource, commandName, id, password) local UFN = GetUserFileName(id) local thenode = xmlLoadFile(UFN) if thenode then if xmlNodeGetValue(thenode) == password then local thenode_info = xmlFindChild (thenode, "Info", 0) SetPlayerValue(playerSource, "Password", xmlNodeGetValue(thenode)) SetPlayerValue(playerSource, "Age", xmlNodeGetAttribute (thenode_info, "Age")) outputChatBox ("성공적으로 로그인 되었습니다.", playerSource) else outputChatBox ("비밀번호가 틀립니다.", playerSource) print(xmlNodeGetValue(thenode)..password) end xmlUnloadFile(thenode) else outputChatBox ("존재하지 않는 아이디입니다.", playerSource) end end addCommandHandler ( "Check", consoleCheckParameters) addCommandHandler ( "register", RegisterPlayer) addCommandHandler ( "login", LoginPlayer) function SpawnPlayer(playerelement) spawnPlayer(playerelement, 0.0, 0.0, 0.0, 0.0, 0) end function GiveElementHealth(theelement, health) setElementHealth(theelement, getElementHealth(theelement) + health) end function GetConnectedPlayers() local playerstable = getElementsByType("player") return table.getn(playerstable) end function SecondTimer() local playerstable = getElementsByType("player") for tablepos, tableelement in ipairs(playerstable) do local x, y, z = getElementPosition(tableelement) --triggerClientEvent (tableelement, "onExplosionBlood", tableelement, x, y, z) end end function ClearChatBox(playerelement) for i = 0, 15 do outputChatBox(" ", playerelement) end end function GetUserFileName(id) return string.format("%s/%s.xml", UserFolderName, id) end function IsXmlCreated(xmlname) if not xmlLoadFile(xmlname) then return false end xmlUnloadFile(xmlname) return true end function MakeXmlFile(xmlname, subject) local thenode = xmlCreateFile (xmlname, subject) if thenode then xmlSaveFile(thenode) end end function GetPlayerValue(playerelement, valuename) return getElementData (playerelement, valuename) end function SetPlayerValue(playerelement, valuename, value) return setElementData (playerelement, valuename, value) end function ResetPlayerValue(playerelement) SetPlayerValue(playerelement, "Registered", false) SetPlayerValue(playerelement, "Age", 0) end function SavePlayer(playerelement, id) local pnode = xmlLoadFile(GetUserFileName(id)) local thenode_info = xmlFindChild (pnode, "Info", 0) xmlNodeSetAttribute (thenode_info, "Age", GetPlayerValue(playerelement, "Age")) xmlSaveFile(pnode) xmlUnloadFile(pnode) end This is my serverside. help me.
  6. sorry, my bad english. It read xml, also after again reading, the value changed. Original value is "123456" It changed value is "123456 " what is " ""? I did not add !! please help me!!
  7. sorry, my bad english. Are xml and file efficiencies different? (It is a file which I says : fileOpen, fileClose, fileCreate.... use the same thing)
  8. Sorry, my bad english Client? Or server? It divides it how?
  9. sorry, my bad english. function OnPlayerChat(message, messageType) outputChatBox("[Player] ".. getPlayerName(source) .. " : " .. message) end ex. ( i type text " hello" ) [chat box] [Player] myname : hello myname : hello i only want to see "[Player] myname : text" i want to delete "myname : hello" sorry my bad english
  10. sorry, my bad english. i read explanation in wiki. but i don't understand. Please, who simply explain this function to me.
  11. what relation "onClientResourceStart" to my question? i don't know.
  12. thank you Then, Don't i trigger "onClientPlayerJoin" event? if so, how can i trigger the event?
  13. if i enter my server, i don't see onClientPlayerJoin event?
  14. sorry, my bad english. GRoot = getRootElement() GRRoot = getResourceRootElement() function ClientModeStart(startedmode) end addEventHandler("onClientResourceStart", GRRoot, ClientModeStart) function ClientPlayerJoin() outputChatBox("* " .. getPlayerName(source) .. " has joined the server") end addEventHandler("onClientPlayerJoin", GRoot, ClientPlayerJoin) function ClientPlayerSpawn() outputChatBox("* " .. getPlayerName(source) .. " spawned") end addEventHandler ("onClientPlayerSpawn", GRoot, ClientPlayerSpawn) onClientPlayerSpawn worked. onClientResourceStart worked. but onClientPlayerJoin didn't work. please. help me.
  15. hello, i have that problem too in addition, i can't make name of Korean server i believe MTA
×
×
  • Create New...