ArmedGuy

Members
  • Content Count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ArmedGuy

  • Rank
    Square
  1. I got a script that when a cop hits a marker a command gets avalible, and when he uses that command that command becomes unavalible... But when i use removeCommandHandler the server crashes and the game too, am im using it on the wrong place? Heres the code: function crimeCommit( playerSource,cmd,crime) local team = getPlayerTeam(playerSource) local teamname = getTeamName(team) if teamname =="SAPD" then if crime=="true" then givePlayerMoney(player, 5000) outputChatBox("Good, That Criminal Is No More, For your Cooperation The SAPD give you 5000 dollars!", player,0,255,0) --added the removeCommandHandler here end if crime=="false" then takePlayerMoney(player, tonumber(10000)) outputChatBox("Prank Calling The Police is NOT ALLOWED, you have now lost 10000 dollars!", player, 255,0,0) --added the removeCommandHandler here end end end this isent the whole code! but what may be the problem?
  2. Or what i did for my Taxi Menu lol, A simple edit box and a button, when you press that button the script gets the text from the box and searches if its in the script for a spawn. Thats pure simplyness(thats not even a real word ^^)
  3. A: For Breakfast Yes Q: Tomato Sauce and Mushrooms?
  4. Yeah, Try Releasing a Preview, like we can look at, but not touch lol ^^. Anyways im looking forward to this as it seems to be epiclly Awsomly Z'Uber Pwnage.
  5. Sorry for bumping, but, does the skin and money of a player get reset if you use the command spawnPlayer? as the script(which is a playerstats script loads the data sucessfully, also when the screens faded out, but then when i use a inbuilt command, /spawn, it goes back to regular CJ and no money
  6. Oh yea, I Finally got it working, and no idea why it didnt work before, even after i removed that source...
  7. Yeah, Its just a piece, but anyone want the whole code to try finding whats wrong? As i seriously cant find any problem.
  8. But when i remove that source i get this Error: Bad Argument @ "getClientName" Thats why i added that source. So anyone know?
  9. Yeah, so when someone logs in to their account i want to retrive their name/account name, but if i use this code: function onPlayerJoin ( source ) if ( saveFile ) then local sourcename = getClientName( source ) addEventHandler("onClientLogin", getRootElement(), onPlayerJoin) i get this error: ERROR: Line Blabla: Bad "Client" Pointer @ getClientName anyone know why?
  10. Well Alexander, depends what you gonna do with the coors. If you just gonna use them to put them into an script to for example spawn a car then you can use a .txt, or even easier just put the game in windowed, open admin panel, select urself and write the coors directly to the script. But If you gonna use a command like if you want to save a pos, then go to it later then xml is better.
  11. actually saving pos is better to an xml or map... i got a script thats working for this, i just gotta find it first lol
  12. there is no clientloginSuccess but there is a onClientLogin
  13. Yea 50p, i will use "onClientLogin" and "getAccountName"... And Also Ty, I got it working now i can finally work on my telephone too
  14. Hokay. Im Trying To Get A Script To Search For a Specific Subnode and Get The Attributes from it But as all the Subnodes have the same name i gotta make it loop through, and i have no idea how to do that. Heres The .lua(now it looks messed up as i tried to make something, didnt work thou) local saveFile = xmlLoadFile ("playerstats.xml") local statscheck = 0 local statssave = 0 function onPlayerQuit ( source ) xmlLoadFile ("playerstats.xml") outputChatBox( "Saving Data", source ) if ( saveFile ) then local subnode = xmlFindSubNode( saveFile, "users", 0 ) local playeraccount = getClientName ( source ) if ( playeraccount ) then local stats = xmlFindSubNode( subnode, "player", statssave ) local name = xmlNodeGetAttribute( stats ,"name") if ((stats) and (name ==""..playeraccount)) then local playermoney = getPlayerMoney ( source ) local playerskin = getPlayerSkin ( source ) local money = xmlNodeSetAttribute( stats, "money", playermoney ) local skin = xmlNodeSetAttribute( stats, "skin", playerskin ) xmlSaveFile ( saveFile ) else statssave = statssave + 1 end end else outputChatBox("File Not Found", source ) end end function onPlayerJoin ( source ) xmlLoadFile ("playerstats.xml") outputChatBox("Loading Acc...", source ) if ( saveFile ) then local playeraccount = getClientName ( source ) if ( playeraccount ) then local subnode = xmlFindSubNode ( saveFile, "users", 0 ) local stats = xmlFindSubNode ( subnode, "player", statscheck ) local name = xmlNodeGetAttribute( stats, "name" ) if (( stats ) and (name ==""..playeraccount)) then local playermoney = xmlNodeGetAttribute( stats, "money" ) local playerskin = xmlNodeGetAttribute( stats, "skin") if (( playermoney ) and ( playerskin )) then setPlayerMoney ( source, playermoney ) setPlayerSkin ( source, playerskin ) end else statscheck = statscheck +1 end else local stats = xmlCreateSubNode( subnode, "player" ) local name = xmlNodeSetAttribute( stats, "name", playeraccount ) xmlSaveFile ( saveFile ) end else outputChatBox("File Not Found", source ) end end addCommandHandler("loadaccount1", onPlayerJoin ) addCommandHandler ( "saveaccount1", onPlayerQuit ) function stoploading () xmlUnloadFile( saveFile ) end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), stoploading ) and heres the .xml that the lua should find from <playerstats> <users> <player name="Dudeinblack" money="99999999" skin="1337"/> <player name="ArmedGuy-JNRNS" money="100000" skin="197"/> <player name="Armadillo" money="1" skin="13" /> </users> </playerstats> Like for example, I Want The .lua to search the xml above for an Subnode with the attribute name="ArmedGuy-JNRNS"... and what i know, to do that the script gotta loop through every singe subnode named player until it finds one with the Attribute name="ArmedGuy-JNRNS"... I Would Like to get some help with this as i only need this working for my scripts to make them tun propertly Ty
  15. Nope... Gamesnert... When I Have The .xml complerly clean, like i have it here on the website, and start the resource everything works perfect. Players gets saved and loaded and all. But when the server/the resource gets restarted, its like the script thats saves and loads player data cant find the .xml with the data. And the only way to fix that is to delete all players data inside the xml and restart the server. And i have no clue why. And Argon... what version did u run it on?... i have DP 2.3( and also i dont have a getPlayerName inside the script, i have getClientName xDxD)