panos144 Posted March 25, 2013 Share Posted March 25, 2013 how can do if i press tab to see the players class? Link to comment
X-SHADOW Posted March 25, 2013 Share Posted March 25, 2013 He Wants make in Scoreboard a cloumn Name (Class) and getPlayers Class Simply he want Level or Account System we dont make the whole script make it and we help you finsh it , Link to comment
panos144 Posted March 26, 2013 Author Share Posted March 26, 2013 somethink like this if help: call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "Class", getRootElement(), 8, 0.07) function getclass() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local class = getPlayerClass(thePlayer) end end end end end end end setTimer(getclass,100,0) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getclass ) that doesn't work just i write for help if is somethink. Link to comment
Castillo Posted March 26, 2013 Share Posted March 26, 2013 How do you set the class? element data? Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 My question is pretty obvious, you want to show the class on the scoreboard, that means that you gotta set it first, how do you set it? Link to comment
panos144 Posted March 27, 2013 Author Share Posted March 27, 2013 i don't know how to set this i'm new on scripting Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 Well, you have a spawn system, right? and when they spawn, there you have to set it. Link to comment
DNL291 Posted March 27, 2013 Share Posted March 27, 2013 Use setElementData to show class on the scoreboard. Link to comment
panos144 Posted March 27, 2013 Author Share Posted March 27, 2013 like this? be cause i can't undestand with element data call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "Class", getRootElement(), 8, 0.07) function getclass() local players = getElementsByType ( "player" ) setElementData ( thePlayer, "playerclass", true ) for theKey,thePlayer in ipairs(players) do local class = getPlayerClass(thePlayer) end end end end end end end setTimer(getclass,100,0) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getclass ) Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 No, post the part where you spawn from your spawn system. Link to comment
panos144 Posted March 27, 2013 Author Share Posted March 27, 2013 --We use the teams for then trigger to client local teamsTable = { ["Ciudadano Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ciudadano E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ciudadano Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125} } addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) setPlayerTeam ( source , team ) local spawnX , spawnY , spawnZ = unpack ( teamsTable [ teamName ] ) spawnPlayer ( source , spawnX , spawnY , spawnZ ) end ) --Team name and team skin local skinsTable = { ["Ruso"] = {14}, ["Soldado Ruso"] = {20}, ["Escuadron Ruso"] = {21}, ["Ciudadano E.E.U.U"] = {15}, ["Ejercito E.E.U.U"] = {16}, ["Escuadron E.E.U.U"] = {17}, ["Ciudadano Japones"] = {13}, ["Ejercito Japones"] = {18}, ["Escuadron Japones"] = {19} } addEvent ( "onPlayerChooseSkin" , true ) addEventHandler ( "onPlayerChooseSkin" , root , function ( skinID ) local skin = unpack ( skinsTable [ skinID ] ) setElementModel(source,skin) end ) --Ammo local ammo = { 1,100,60,150,50,5,300 } --Teams, weapons and ammo addEvent ( "onPlayerChooseAmmo" , true ) addEventHandler ( "onPlayerChooseAmmo" , root , function ( ) local playerTeam = getPlayerTeam ( source ) if playerTeam then if playerTeam == getTeamFromName ("Ciudadano Ruso") then giveWeapon(source,1, tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito Ruso") then giveWeapon(source,22,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron Ruso") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) elseif playerTeam == getTeamFromName ("Ciudadano E.E.U.U") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) elseif playerTeam == getTeamFromName ("Ciudadano Japones") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito Japones") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron Japones") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) end end end ) from here https://community.multitheftauto.com/ind ... ls&id=6487 Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Class", getRootElement(), 8, 0.07) --We use the teams for then trigger to client local teamsTable = { ["Ciudadano Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron Ruso"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ciudadano E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron E.E.U.U"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ciudadano Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Ejercito Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125}, ["Escuadron Japones"] = {1553.0385742188 , -1675.7225341797 , 16.1953125} } addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) setPlayerTeam ( source , team ) local spawnX , spawnY , spawnZ = unpack ( teamsTable [ teamName ] ) spawnPlayer ( source , spawnX , spawnY , spawnZ ) setElementData ( source, "Class", teamName ) end ) --Team name and team skin local skinsTable = { ["Ruso"] = {14}, ["Soldado Ruso"] = {20}, ["Escuadron Ruso"] = {21}, ["Ciudadano E.E.U.U"] = {15}, ["Ejercito E.E.U.U"] = {16}, ["Escuadron E.E.U.U"] = {17}, ["Ciudadano Japones"] = {13}, ["Ejercito Japones"] = {18}, ["Escuadron Japones"] = {19} } addEvent ( "onPlayerChooseSkin" , true ) addEventHandler ( "onPlayerChooseSkin" , root , function ( skinID ) local skin = unpack ( skinsTable [ skinID ] ) setElementModel(source,skin) end ) --Ammo local ammo = { 1,100,60,150,50,5,300 } --Teams, weapons and ammo addEvent ( "onPlayerChooseAmmo" , true ) addEventHandler ( "onPlayerChooseAmmo" , root , function ( ) local playerTeam = getPlayerTeam ( source ) if playerTeam then if playerTeam == getTeamFromName ("Ciudadano Ruso") then giveWeapon(source,1, tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito Ruso") then giveWeapon(source,22,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron Ruso") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) elseif playerTeam == getTeamFromName ("Ciudadano E.E.U.U") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron E.E.U.U") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) elseif playerTeam == getTeamFromName ("Ciudadano Japones") then giveWeapon(source,1,tonumber ( ammo[1] ),true) giveWeapon(source,4,tonumber ( ammo[1] ),true) giveWeapon(source,22,tonumber ( ammo[2] ),true) elseif playerTeam == getTeamFromName ("Ejercito Japones") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) elseif playerTeam == getTeamFromName ("Escuadron Japones") then giveWeapon(source,24,tonumber ( ammo[3] ),true) giveWeapon(source,27,tonumber ( ammo[5] ),true) giveWeapon(source,29,tonumber ( ammo[7] ),true) giveWeapon(source,30,tonumber ( ammo[7] ),true) giveWeapon(source,34,tonumber ( ammo[5] ),true) giveWeapon(source,17,tonumber ( ammo[6] ),true) giveWeapon(source,44,tonumber ( ammo[1] ),true) end end end ) Link to comment
panos144 Posted March 27, 2013 Author Share Posted March 27, 2013 still don't work and it say WARNING: spawn/teamSpawn.lua:1: Bad argument 'call' i must add and this? call(getResourceFromName("dxscoreboard"), "addScoreboardColumn", "Class", getRootElement(), 8, 0.07) function getclass() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local class = getPlayerClass(thePlayer) end end end end end end end setTimer(getclass,100,0) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getclass ) Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 Copy the code again, and no, you don't have to use that. Link to comment
panos144 Posted March 28, 2013 Author Share Posted March 28, 2013 thanks!!!! working perfect! Link to comment
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