sckatchof Posted February 25, 2012 Posted February 25, 2012 hello guys i want to make ascript that sho in scorboad like this pic This is my script : exports["scoreboard"]:scoreboardAddColumn("Zone",root,30,"City") function CityZ() local playerX, playerY, playerZ = getElementPosition ( localPlayer ) local playerZoneName = getZoneName ( playerX, playerY, playerZ ) setElementData (source,"Zone" , playerZoneName) end setTimer(CityZ, 1000, 1) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), CityZ )
Kenix Posted February 25, 2012 Posted February 25, 2012 localPlayer only in client side .. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 localPlayer only in client side .. And this : exports["scoreboard"]:scoreboardAddColumn("Zone",root,30,"City") function CityZ() local city = getZoneName ( x, y, z ) setElementData (city,"Zone" , getZoneName (source)) end setTimer(CityZ, 1000, 1) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), CityZ )
Kenix Posted February 25, 2012 Posted February 25, 2012 exports["scoreboard"]:scoreboardAddColumn( "Zone",root,30,"City" ) local uTimers = { } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ ) setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) Updated. Learn it https://wiki.multitheftauto.com/wiki/Scr ... troduction http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 thank you agian for help but it dont work.
Kenix Posted February 25, 2012 Posted February 25, 2012 /debugscript 3? meta.xml ? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 /debugscript 3?meta.xml ? Meta : /debugscript 3 nothings
Kenix Posted February 25, 2012 Posted February 25, 2012 exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ ) setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) Updated again. Tested. I see now export functions in resource scoreboard and i not found 'scoreboardAddColumn'. So you need use function addScoreboardColumn or add scoreboardAddColumn to meta.xml( export function). http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 Thank you for help Kenix but you don't understand me what i want like this pic when i go to los santos it show in scrorboad like this Zone ===> LS or LV or SF addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","Zone", getRootElement(), 5, 0.04) end ) function Zone() local playerX, playerY, playerZ = getElementPosition( getLocalPlayer() ) local playerZoneName = getZoneName( playerX, playerY, playerZ ) setElementData ( source, "Zone", playerZoneName ) setTimer(getwan,100,0) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Zone )
Kenix Posted February 25, 2012 Posted February 25, 2012 exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
drk Posted February 25, 2012 Posted February 25, 2012 exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) I think he is saying that he wants like when you are in Los Santos, Zone will be "LS", if you are in San Fierro will be "SF", if you are in Las Venturas will be "LV". EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted February 25, 2012 Posted February 25, 2012 exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } local zoneNames = { ["Los Santos"] = "LS", ["San Fierro"] = "SF", ["Las Venturas"] = "LV" } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ, true ) setElementData ( player, "Zone", zoneNames[playerZoneName] or playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onPlayerJoin',root,setZoneData ) addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kenix Posted February 25, 2012 Posted February 25, 2012 (edited) exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } local t = { ['Los Santos'] = 'LS'; ['Las Venturas'] = 'LV'; ['San Fierro'] = 'SF'; } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) if playerZoneName == 'Los Santos' or playerZoneName == 'Las Venturas' or playerZoneName == 'San Fierro' then playerZoneName = t[ playerZoneName ] else playerZoneName = 'none' end setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) Tested and updated again. Edited February 25, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Castillo Posted February 25, 2012 Posted February 25, 2012 I've tested mine and worked, I was in Los Santos and "Zone" was "LS". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kenix Posted February 25, 2012 Posted February 25, 2012 Use my code i tested it now. If you in los santos then LS. If in country side then none. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 I've tested mine and worked, I was in Los Santos and "Zone" was "LS". i tested it but sometimes it show and sometimes does not show
Kenix Posted February 25, 2012 Posted February 25, 2012 (edited) Use my code i tested it now.If you in los santos then LS. If in country side then none. http://imageshack.us/photo/my-images/81 ... 021047.png http://imageshack.us/photo/my-images/29 ... 021058.png Edited February 25, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 Use my code i tested it now.If you in los santos then LS. If in country side then none. Kenix i use ur code but some problem i make ss :
Kenix Posted February 25, 2012 Posted February 25, 2012 Try again. Your resource named is scoreboard?( not Scoreboard ?Case sensitive ) Not debug errors? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 Try again.Your resource named is scoreboard?( not Scoreboard ?Case sensitive ) Not debug errors? Yes is Scoreboard and i dont have any errors a try many time : Server side : exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } local t = { ['Los Santos'] = 'LS'; ['Las Venturas'] = 'LV'; ['San Fierro'] = 'SF'; } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) if playerZoneName == 'Los Santos' or playerZoneName == 'Las Venturas' or playerZoneName == 'San Fierro' then playerZoneName = t[ playerZoneName ] else playerZoneName = 'none' end setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) and this is my MTA.xml : "Sckatchof description="Scoreboard" type="script" version="1.0.0" /> server" /> server" /> server" />
drk Posted February 25, 2012 Posted February 25, 2012 Try again.Your resource named is scoreboard?( not Scoreboard ?Case sensitive ) Not debug errors? Yes is Scoreboard and i dont have any errors a try many time : Server side : exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } local t = { ['Los Santos'] = 'LS'; ['Las Venturas'] = 'LV'; ['San Fierro'] = 'SF'; } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) if playerZoneName == 'Los Santos' or playerZoneName == 'Las Venturas' or playerZoneName == 'San Fierro' then playerZoneName = t[ playerZoneName ] else playerZoneName = 'none' end setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) and this is my MTA.xml : "Sckatchof description="Scoreboard" type="script" version="1.0.0" /> server" /> server" /> server" /> MTA.xml? LOL meta.xml. And it's wrong. Correct: "Sckatchof" description="Scoreboard" type="script" version="1.0.0" /> EPT Team Server Development: 0% Learning C++ | C++ is amazing
sckatchof Posted February 25, 2012 Author Posted February 25, 2012 Try again.Your resource named is scoreboard?( not Scoreboard ?Case sensitive ) Not debug errors? Yes is Scoreboard and i dont have any errors a try many time : Server side : exports.scoreboard:addScoreboardColumn( "Zone",root,3,0.15 ) local uTimers = { } local t = { ['Los Santos'] = 'LS'; ['Las Venturas'] = 'LV'; ['San Fierro'] = 'SF'; } function setZoneData( player ) local player = player or source if isTimer( uTimers[ player ] ) then killTimer( uTimers[ player ] ) end uTimers[ player ] = setTimer( function( player ) local playerX, playerY, playerZ = getElementPosition ( player ) local playerZoneName = getZoneName ( playerX, playerY, playerZ,true ) if playerZoneName == 'Los Santos' or playerZoneName == 'Las Venturas' or playerZoneName == 'San Fierro' then playerZoneName = t[ playerZoneName ] else playerZoneName = 'none' end setElementData ( player,"Zone" , playerZoneName ) end, 1000, 0, player ) end addEventHandler( 'onResourceStart',resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do setZoneData( v ) end end ) addEventHandler( 'onPlayerQuit',root, function( ) if isTimer( uTimers[ source ] ) then killTimer( uTimers[ source ] ) end uTimers[ source ] = nil end ) addEventHandler( 'onPlayerJoin',root,setZoneData ) and this is my MTA.xml : "Sckatchof description="Scoreboard" type="script" version="1.0.0" /> server" /> server" /> server" /> MTA.xml? LOL meta.xml. And it's wrong. Correct: "Sckatchof" description="Scoreboard" type="script" version="1.0.0" /> Omg i know i have many script in meta.xml and its work .... meta.xml ---Mode TNS "Sckatchof" type="gamemode" name="CnR/RPG/TUN" description="My first MTA DM server" />
Kenix Posted February 25, 2012 Posted February 25, 2012 Upload your resource http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now