Jump to content

Need help


kuba90pl

Recommended Posts

server:

function aza(gracz,auto) 
id=getVehicleModelFromName(auto) 
player=getPlayerFromName(gracz) 
acc=getPlayerAccount(player) 
setAccountData(acc,"player.idauta",veh) 
setAccountData(acc,"player.czymaauto","1") 
samochody = xmlLoadFile("misc/auta.xml") 
veh="veh"..math.random(1,9)..""..math.random(1,9)..""..math.random(1,9)..""..math.random(1,9)..""..math.random(1,9).."" 
xmlCreateChild(samochody, veh) 
znalezione=xmlFindChild(samochody,veh,0) 
xmlNodeSetAttribute(znalezione,"modelid",id) 
xmlNodeSetAttribute(znalezione,"owner",gracz) 
xmlNodeSetAttribute(znalezione,"posx","-1726.7235107422") 
xmlNodeSetAttribute(znalezione,"posy","-122.06607055664") 
xmlNodeSetAttribute(znalezione,"posz","3") 
xmlNodeSetAttribute(znalezione,"rotx","0") 
xmlNodeSetAttribute(znalezione,"roty","0") 
xmlNodeSetAttribute(znalezione,"rotz","0") 
xmlNodeSetAttribute(znalezione,"plate",gracz) 
xmlNodeSetAttribute(znalezione,"fuel","100") 
xmlNodeSetAttribute(znalezione,"water","0") 
xmlNodeSetAttribute(znalezione,"olej","100") 
bufferAuto=1 
xmlSaveFile(samochody) 
end 
addEvent("akceptujZakupAuta",true) 
addEventHandler("akceptujZakupAuta",root,aza) 

client:

function kupSamochod() 
nazwa=guiGetText(GUIEditor_Label[1]) 
buff=tostring(nazwa) 
name=getPlayerName(localPlayer) 
triggerServerEvent("akceptujZakupAuta",localPlayer,name,buff,cena) 
destroyElement(GUIEditor_Window[1]) 
aMaleOkno("Gratulacje!","Wlasnie kupiles "..buff.." za "..cena.."! ") 
end 
ckasa=0 

so this script working properly , but its creating 2 vehicles in auta.xml instead of one :

<vehicles> 
     
    <veh44744 modelid="589" owner="Oli" posx="-1726.7235107422" posy="-122.06607055664" posz="3" rotx="0" roty="0" rotz="0" plate="Oli" fuel="100" water="0" olej="100"></veh44744> 
    <veh86335 modelid="589" owner="Oli" posx="-1726.7235107422" posy="-122.06607055664" posz="3" rotx="0" roty="0" rotz="0" plate="Oli" fuel="100" water="0" olej="100"></veh86335> 
</vehicles> 
  

how to fix that , if i want to create only one car? (no 2)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...