-
Posts
296 -
Joined
-
Last visited
Posts posted by TheIceman1
-
-
You have it on MTA community:
Turf system:https://community.multitheftauto.com/index.php?p=resources&s=details&id=6772
Gang system:https://community.multitheftauto.com/index.php?p=resources&s=details&id=1514
-
Try this:
addEvent( 'onStartRobber',true ) addEvent( 'onEndRobber',true ) local timer,timerOpenBank local bankMarker = createMarker( 364.00500488281,163.38682556152,1008.3828125,"cylinder",3,150,0,0,255 ) local bankBip = createBlip ( 2416.5532226563, 1124.1168212891, 10.8203125, 36, 2 ) setElementInterior( bankMarker,3,364.00500488281,163.38682556152,1007.4828125 ) local bankColshape = createColCircle ( 2414.1735839844,1123.9982910156,10.8203125,1 ) function findMarker( source ) if isElement( source ) then local ret = false for _,v in pairs( getElementsByType 'marker' ) do if getElementData( v,'attack' ) == source then ret = v end end return ret end return false end function resetRobber( ) setElementData( bankMarker,'attack',nil ) setElementData( bankColshape,'attackShape',nil ) end function setRobberDefault( ) if isTimer( timerOpenBank ) then killTimer( timerOpenBank ) end if isTimer( timer ) then killTimer( timer ) end setElementData( bankMarker,'attack',nil ) setElementData( bankColshape,'attackShape',nil ) setElementAlpha( bankMarker,255 ) setElementData( bankMarker,'protected',nil ) setElementData( bankColshape,'protectedShape',nil ) triggerClientEvent( 'onSoundRobberyStop',root ) end addEventHandler( 'onColShapeLeave',bankColshape, function( LeaveElement,dim ) if getElementType( LeaveElement ) == 'player' then if getElementData( source,'attackShape' ) == LeaveElement then outputChatBox( "Bank Robbery: Complete",LeaveElement,255,0,0 ) setRobberDefault( ) end end end ) addEventHandler( 'onPlayerWasted',root, function( ) if findMarker( source ) then outputChatBox( "Bank Robbery: Failed",source,255,0,0 ) setRobberDefault( ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if findMarker( source ) then setRobberDefault( ) end end ) addEventHandler( "onMarkerHit",bankMarker, function( hitElement, matchingDimension ) if getElementType( hitElement ) == 'player' then if ( getPlayerTeam ( source ) == "Robbers" ) then if not getElementData( source,'attack' ) and not getElementData( source,'protected' ) then triggerClientEvent( hitElement,'onClientRobberMenu',hitElement,source ) else outputChatBox( 'Bank Robbery: You can rob the bank',hitElement,255,0,0 ) end end end end ) addEventHandler( 'onEndRobber',root, function( marker ) setElementData( bankMarker,'protected','y' ) setElementData( bankColshape,'protectedShape','y' ) if isTimer( timerOpenBank ) then killTimer( timerOpenBank ) end timerOpenBank = setTimer( setRobberDefault,10000,1 ) -- ????? ????? ??????? ???? ????? ????? ????? ???????? end ) addEventHandler( 'onStartRobber',root, function( ) setElementAlpha( bankMarker, 0 ) setElementData( bankMarker,'attack',source ) setElementData( bankColshape,'attackShape',source ) setPlayerWantedLevel( source,6 ) local cops = getPlayersInTeam ( getTeamFromName( "Police" ) ) outputChatBox( getPlayerName(source).." start bank rob!",cops,250,0,0 ) triggerClientEvent( 'onSoundRobbery',root ) if isTimer( timer ) then killTimer( timer ) end timer = setTimer( function( player,mark ) outputChatBox( "Bank Robbery: Complete",player,0,30,255 ) resetRobber( ) givePlayerMoney( player,21000 ) triggerClientEvent( 'onSoundRobberyStop',root ) triggerEvent( 'onEndRobber',player,mark ) end, 60000,1,source,bankMarker ) end )
-
Working,thanks!
-
function destroyclan () local clan = getElementData ( source, "clan" ) local acc = getPlayerAccount ( source ) local clansroot = xmlLoadFile ("clans.xml") if ( clansroot ) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local xmlnumber = xmlNodeGetAttribute (v,"name") xmlDestroyNode ( v ) xmlSaveFile ( clansroot ) xmlUnloadFile ( clansroot ) exports ["guimessages"] : outputServer ( source, "You destroy your clan!", 255, 255, 0 ) setAccountData ( acc, "Clan", false ) removeElementData ( source, "clan" ) end end end addEvent ( "destroyclan", true ) addEventHandler ( "destroyclan", root, destroyclan )
-
I have new problem.
Players make clans then in clans.xml said this :
<clans> <clans name="Military"></clans> <clans name="SWAT"></clans> <clans name="FBI"></clans> </clans>
But when i delete "Military" then in clans.xml said this(all clans are deleted):
<clans> </clans>
But i want this,when i delete "Military" then in clans.xml said this:
<clans> <clans name="SWAT"></clans> <clans name="FBI"></clans> </clans>
Code:
local clansroot = xmlLoadFile ("clans.xml") if ( clansroot ) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local clanname = xmlNodeGetAttribute (v,"name") xmlDestroyNode ( v ) xmlSaveFile ( clansroot ) xmlUnloadFile ( clansroot )
-
Working thanks!
-
-
I see no problems...
-
You mean this?But this dont work
local root = xmlLoadFile ("clans.xml") clroot = xmlCreateChild(root, "clans") xmlNodeSetAttribute (clroot,"name", clan) end xmlSaveFile( root ) xmlUnloadFile ( root )
-
When i make clan "Military" then in clans.xml said this:
<clans> <clans name="Military"></clans> </clans>
But when other player make new clan then in clans.xml said this and remove my clan:
<clans> <clans name="SWAT"></clans> </clans>
But i want this:
<clans> <clans name="Military"></clans> <clans name="SWAT"></clans> </clans>
Code
local root = xmlLoadFile ("clans.xml") local clroot = xmlFindChild (root,"clans",0) if (clroot) then xmlNodeSetAttribute (clroot,"name", clan) else clroot = xmlCreateChild(root, "clans") xmlNodeSetAttribute (clroot,"name", clan) end xmlSaveFile( root ) xmlUnloadFile ( root )
Understand what i want?
-
No Am Making A Panel With 10 Buttons Ok? And if i click that button let's say -50 health and i have 30 health ok?
when i press the button i get full health
I dont understand what you want
-
This?
addCommandHandler("slap", function ( plr ) if getElementHealth(plr) =< 50 then setElementHealth ( plr, getElementHealth(plr) - 90 ); outputChatBox("True") else outputChatBox("False") end end )
-
-
-
xmlLoadFile already returns pointer to the root of the xml file, so you don't need to search 'clans' node again with xmlFindChild. Try to comment the 5th line and rename 'clans' variable to 'clansroot' in the 4th line and see if that helps.
Working,Thanks!
-
Radi hvala!
-
No
-
Why this dont delete clan from "clans.xml"?
function destroyclan () local clan = getElementData ( source, "clan" ) removeElementData ( source, "clan" ) local clans = xmlLoadFile ("clans.xml") local clansroot = xmlFindChild (clans,"clans",0) if (clansroot) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local xmlnumber = xmlNodeGetAttribute (v,"name") if ( xmlnumber == clan ) then xmlDestroyNode ( v ) end xmlSaveFile ( clans ) xmlUnloadFile ( clans ) end end end addEvent ( "destroyclan", true ) addEventHandler ( "destroyclan", root, destroyclan )
-
But i want delete only this:
"FBI">
in this:
"FBI">
-
Zkj mi neče izbrisat clan iz "clans.xml"?
function destroyclan () local clan = getElementData ( source, "clan" ) removeElementData ( source, "clan" ) local clans = xmlLoadFile ("clans.xml") local clansroot = xmlFindChild (clans,"clans",0) if ( clansroot ) then for i,v in ipairs (xmlNodeGetChildren(clansroot)) do local xmlnumber = xmlNodeGetAttribute (v,"clan") xmlDestroyNode ( v ) xmlSaveFile ( clans ) xmlUnloadFile ( clans ) end end end addEvent ( "destroyclan", true ) addEventHandler ( "destroyclan", root, destroyclan )
XML
"FBI">
-
You're trying to delete the children of this node:
clan="FBI">>
Since it contains no children, nothing is deleted. It happens this way because xmlFileLoad returns this node:
>...>
And then you're getting its first child (FBI clan) as 'clansroot', then looping through its children (which don't exist, therefore nothing is removed). You're supposed to loop through the children of 'clans' instead.
In addition, you're saving and unloading the XML file inside the loop - that's wrong. You should do this after the loop. If you unload the file inside the loop, it won't be available for the next iteration, causing an error. Saving the file repeatedly will have no effect on the result, but doing so will needlessly reduce the performance.
I absolutely dont understand...
-
-
-
Nobody will help me?
Report community resources here!
in Suggestions
Posted
He upload my script.
DONE!
https://community.multitheftauto.com/index.php?p=resources&s=details&id=7093