Jump to content

dugasz1

Members
  • Posts

    285
  • Joined

  • Last visited

Everything posted by dugasz1

  1. Now i know how make the server to use space in the names. Thanks for help
  2. Hello! I found a new local chat script. It's working just when a write a command (example.: /reconnect) It's writing out in the cahtbox /reconenct. I searching on the internet and now the script know what is command what it's simple message,but i don't know what can i do whit the command how i can use. chat_range=5 function bindOnJoin() bindKey(source,"t","down","chatbox","Mondod") end addEventHandler("onPlayerJoin",getRootElement(),bindOnJoin) function bindRStart() for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","Mondod") end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), bindRStart) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) if string.sub(msg, 1, 1) == "/" then --What should here write? else for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox(nick.." mondja: "..msg,v,255,255,255,true) end end end end addCommandHandler("Mondod",onChat)
  3. Thanks it's working perfect It got 2 error: 1. Bad event 2. And the function (here) writed things.
  4. Now i understand the problem to a call bad element (I guess) But i don't know how i call the player who's left when i use addEventHanler() Somebody/You can explain me? (I writed this but its maybe nonsense. mmm... and i don't understand what should i write in the function's parenthesis pl.: function (here)[/lua]): function onExit ( root ) local newx, newy, newz = getElementPosition( root ) local newpenz = getPlayerMoney ( root ) local newhp = getElementHealth ( root ) local newarmor = getPedArmor ( root ) -- Mysql rész local pName = getPlayerName( root ) local sqlpName = mysql_query(handler,"SELECT * FROM account_data WHERE IGName = '"..pName.."';") local pAdat = mysql_fetch_assoc(sqlpName) mysql_query(handler,"UPDATE account_data SET x="..newx..", y="..newy..", z="..newz..", hp="..newhp..", armor="..newarmor.." WHERE IGName='"..pAdat['IGName'].."' ;") --outputChatBox("Saved "..pAdat['IGName'].." !", source, 255, 0, 0) outputDebugString("One player adat has been saved!") end --addCommandHandler("save",onExit) addEventHandler ("onPlayerExit", root, onExit) (It isn't work)
  5. I know it isnt change the name in settings(it's good for me now) but i doesen't know how i can call it.
  6. Hy! We write a player data saver, but i got some problem whit it. function onExit ( playerSource ) local newx, newy, newz = getElementPosition( playerSource ) local newpenz = getPlayerMoney ( playerSource ) local newhp = getElementHealth ( playerSource ) local newarmor = getPedArmor ( playerSource ) -- Mysql rész local pName = getPlayerName(playerSource) local sqlpName = mysql_query(handler,"SELECT * FROM account_data WHERE AccountName = '"..pName.."';") local pAdat = mysql_fetch_assoc(sqlpName) mysql_query(handler,"UPDATE account_data SET x="..newx..", y="..newy..", z="..newz..", hp="..newhp..", armor="..newarmor.." WHERE AccountName='"..pAdat['IGName'].."' ;") outputChatBox("Saved "..pAdat['AccountName'].."!", source, 255, 0, 0) end addCommandHandler("save",onExit) It's working fine now,but it's manually. We want to make this automaticly if the player quit,but this addEventHandler ( "onPlayerQuit", getRootElement(), onQuit ) doesen't work it's save always the same datas. (Something default or i don't know. Save this: x,y,z = 2497, 2497,2496.604492187) Any idea
  7. huu Sorry, i fixed the problem. I saw a server where we can use space to my character name but it don't support space in the setPlayerName
  8. Now i got an error message: WARNING: sawmode\sawmode.lua:48 Bad argument @ 'md5' ERORR: sawmode\sawmode.lua:48 Bad argument #2 to 'mysql_escape_string' <string expected got boolean>
  9. oops Thats just a fail. I trying it whit player too but the same problem Here the client side maybe it's help to find out what's the problem: (user_edit_l = the player login name pw_edit_l = the password) function login_player ( source ) triggerServerEvent ( "onLogin", getRootElement(), getLocalPlayer(), guiGetText(user_edit_l), guiGetText(pw_edit_l) ) end addEventHandler("onClientGUIClick", login_btn_l, login_player,false) And the i forgot the adEvent addEvent( "onLogin", true ) addEventHandler( "onLogin", getRootElement(), onLogin )
  10. Hi! (Sorry for my bad english ) I got some problem whit the setPlayerName. function onLogin ( player, user, pass ) handler = mysql_connect( host, username, password, db ) local login = mysql_query(handler,"SELECT * FROM account_data WHERE AccountName = '"..mysql_escape_string( handler, user ).."' AND Password = '"..mysql_escape_string( handler, md5(pass) ).."';") if login then local rows = mysql_num_rows(login) if rows == 1 then local adat = mysql_fetch_assoc(login) triggerClientEvent( player, "closeWindow", getRootElement() ) outputChatBox("* Login succes! Welcome "..adat['AccountName'].."!", player, 255, 0, 0) spawnPlayer( player, adat['x'], adat['y'], adat['z'], 0, JoinSkin ) fadeCamera( player, true ) setCameraTarget( player, player ) giveWeapon( player, joinWeapon, joinAmmo ) setPlayerMoney( player, adat['penz'] ) setPedArmor ( player, adat['armor'] ) setElementHealth ( player, adat['hp'] ) setPlayerName ( source , adat['IGName']) else outputChatBox("* Login failed!", player, 255, 0, 0) end mysql_free_result(login) end end Everything working fine , i get the money,hp,armor... but my name still the original. No error message nothing. I trying to search for answers but i can't fix it. I'm very beginner somebody explain to me simple what's wrong Thanks
×
×
  • Create New...