Jump to content

Teams and something else


Troold

Recommended Posts

I have a little big problem with my teams script 0.o, it assigning team but don't spawn! ;/

this is my script

function createTeamsOnStart ()
 
       teamLudzie = createTeam ( "Ludzie", 255, 255, 0 )
       teamZombiclassic = createTeam ( "Zombiclassic", 0, 200, 0 )
       teamZombiraptor = createTeam ( "Zombiraptor", 0, 200, 0 )
       teamZombiheavy = createTeam ( "Zombiheavy", 0, 200, 0 )
       teamZombi = createTeam ( "Zombi", 0, 200, 0 )
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  )
 
function assignLudzieTeam ( player, commandName )
setPlayerTeam ( player, teamLudzie )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
setPlayerNametagColor ( player, 225, 225, 0 )
end
addCommandHandler ( "ludzie", assignLudzieTeam )
 
function assignZombiclassicTeam ( player, commandName )
setPlayerTeam ( player, teamZombiclassic )
setElementModel ( player, 258 ) 
end
addCommandHandler ( "classic", assignZombiclassicTeam )
 
function assignZombiraptorTeam ( player, commandName )
setPlayerTeam ( player, teamZombiraptor )
setElementModel ( player, 70 )  
end
addCommandHandler ( "raptor", assignZombiraptorTeam )
 
function assignZombiheavyTeam ( player, commandName )
setPlayerTeam ( player, teamZombiheavy )
setElementModel ( player, 127 ) 
setPedArmor ( player, 200 )
end
addCommandHandler ( "heavy", assignZombiheavyTeam )
 
function assignZombiTeam ( player, commandName )
setPlayerTeam ( player, teamZombi )
setElementModel ( player, 69 ) 
end
addCommandHandler ( "zombi", assignZombiTeam )
 
function assignNewLudzie ( )
 setPlayerTeam ( source, teamLudzie )
spawnPlayer ( player, 213.26884460449, 1873.2000732422, 13.140625, 0.0, 0 )
 fadeCamera ( source, true )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
setPlayerNametagColor ( player, 225, 225, 0 )
 setPlayerNametagColor ( player, 255, 255, 0 )
end
addEventHandler ( "onPlayerJoin", getRootElement(), assignNewLudzie )
 
function afterWasted()
    respawnPlayer(source, getPlayerTeam(source))
end
 
function respawnPlayer(player, theTeam)
    if (theTeam == teamLudzie) then
         spawnPlayer ( player, 213.26884460449, 1873.2000732422, 13.140625 )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
         setPlayerNametagColor ( player, 225, 225, 0 )
    elseif (theTeam == teamZombiclassic) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 258 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombiraptor) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 70 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombiheavy) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
         setPedArmor ( player, 200 )
setElementModel ( player, 127 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombi) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 69 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    end
end
 
addEventHandler( "onPlayerWasted", getRootElement(), afterWasted )

and i have a little question, why my settings in meta don't work? 0.o

I mean that

<settings>
       <setting name="#respawn_time" value="[ 10 ]" />
       <setting name="#spawn_weapons" value='[ "22:100" ]' />
       <setting name="#gravity" value="[ 0.008000 ]" />
       <setting name="#waveheight" value="[ 0 ]" />
       <setting name="#time_limit" value="[ 900 ]" />
       <setting name="#locked_time" value="[ true ]" />
       <setting name="#weather" value="[ 15 ]" />
       <setting name="#time" value="0:0" />
   </settings>

Edited by Guest
Link to comment

When does it not spawn? When you join server? When you die? You need to know when it doesn't spawn you and once you know just check the function attached to the specific event.

Debug! Debug! Debug! All of you people out there, you should start to learn how to debug your script.. Once you know how to debug your script, you can solve every single problem you have with your script (as far as you know how to fix it). It's easy and won't take you long to learn it. It's just using outputChatBox, outputDebugString or outputConsole in the places when you think your code fails.

Have a read:

https://wiki.multitheftauto.com/wiki/Debugging

Link to comment
I have a little big problem with my teams script 0.o, it assigning team but don't spawn! ;/

this is my script

function createTeamsOnStart ()
 
       teamLudzie = createTeam ( "Ludzie", 255, 255, 0 )
       teamZombiclassic = createTeam ( "Zombiclassic", 0, 200, 0 )
       teamZombiraptor = createTeam ( "Zombiraptor", 0, 200, 0 )
       teamZombiheavy = createTeam ( "Zombiheavy", 0, 200, 0 )
       teamZombi = createTeam ( "Zombi", 0, 200, 0 )
end
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  )
 
function assignLudzieTeam ( player, commandName )
setPlayerTeam ( player, teamLudzie )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
setPlayerNametagColor ( player, 225, 225, 0 )
end
addCommandHandler ( "ludzie", assignLudzieTeam )
 
function assignZombiclassicTeam ( player, commandName )
setPlayerTeam ( player, teamZombiclassic )
setElementModel ( player, 258 ) 
end
addCommandHandler ( "classic", assignZombiclassicTeam )
 
function assignZombiraptorTeam ( player, commandName )
setPlayerTeam ( player, teamZombiraptor )
setElementModel ( player, 70 )  
end
addCommandHandler ( "raptor", assignZombiraptorTeam )
 
function assignZombiheavyTeam ( player, commandName )
setPlayerTeam ( player, teamZombiheavy )
setElementModel ( player, 127 ) 
setPedArmor ( player, 200 )
end
addCommandHandler ( "heavy", assignZombiheavyTeam )
 
function assignZombiTeam ( player, commandName )
setPlayerTeam ( player, teamZombi )
setElementModel ( player, 69 ) 
end
addCommandHandler ( "zombi", assignZombiTeam )
 
function assignNewLudzie ( )
 setPlayerTeam ( source, teamLudzie )
spawnPlayer ( player, 213.26884460449, 1873.2000732422, 13.140625, 0.0, 0 )
 fadeCamera ( source, true )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
setPlayerNametagColor ( player, 225, 225, 0 )
 setPlayerNametagColor ( player, 255, 255, 0 )
end
addEventHandler ( "onPlayerJoin", getRootElement(), assignNewLudzie )
 
function afterWasted()
    respawnPlayer(source, getPlayerTeam(source))
end
 
function respawnPlayer(player, theTeam)
    if (theTeam == teamLudzie) then
         spawnPlayer ( player, 213.26884460449, 1873.2000732422, 13.140625 )
giveWeapon ( player, 17, 900)
giveWeapon ( player, 29, 900)
giveWeapon ( player, 31, 900)
setElementModel ( player, 29 ) 
         setPlayerNametagColor ( player, 225, 225, 0 )
    elseif (theTeam == teamZombiclassic) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 258 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombiraptor) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 70 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombiheavy) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
         setPedArmor ( player, 200 )
setElementModel ( player, 127 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    elseif (theTeam == teamZombi) then
         spawnPlayer ( player, 261.11389160156, 1396.8560791016, 10.5859375 )
setElementModel ( player, 69 ) 
         setPlayerNametagColor ( player, 0, 200, 0 )
    end
end
 
addEventHandler( "onPlayerWasted", getRootElement(), afterWasted )

and i have a little question, why my settings in meta don't work? 0.o

I mean that

<settings>
       <setting name="#respawn_time" value="[ 10 ]" />
       <setting name="#spawn_weapons" value='[ "22:100" ]' />
       <setting name="#gravity" value="[ 0.008000 ]" />
       <setting name="#waveheight" value="[ 0 ]" />
       <setting name="#time_limit" value="[ 900 ]" />
       <setting name="#locked_time" value="[ true ]" />
       <setting name="#weather" value="[ 15 ]" />
       <setting name="#time" value="0:0" />
   </settings>

Let me see. On resource start is missing, is it not?

Also, show us Meta, server, and client, and other.

Link to comment

Oh, stupid gamemode BTW. Try changing it.

function createTeamsOnStart ()
       teamCows = createTeam ( "Cows", 255, 255, 0 )
       teamPigs = createTeam ( "Pigs", 0, 200, 0 )
       teamRoosters = createTeam ( "Roosters", 0, 200, 0 )
       teamHorses = createTeam ( "Horses", 0, 200, 0 )
       teamPigeons = createTeam ( "Pigeons", 0, 200, 0 )
end
 
--AND ADD THIS
 
function assignPigsTeam ( player, commandName )
setPlayerTeam ( player, teamPigs )
giveWeapon ( player, 13, 1) --DILDO!!!!!!!
setElementModel ( player, 258 ) 
end
addCommandHandler ( "Pigs", assignPigsTeam )

Link to comment

function assignNewLudzie ( )

setPlayerTeam ( source, teamLudzie )

for i,player in ipairs(getElementsByType("player")) do

spawn(player)

end

end

function spawn(player)

repeat until spawnPlayer ( player, 213+math.random(1,5), 1873+math.random(5,9), 15, 90, math.random(9,288) )

fadeCamera(player, true)

setCameraTarget(player, player)

fadeCamera ( source, true )

giveWeapon ( player, 17, 900)

giveWeapon ( player, 29, 900)

giveWeapon ( player, 31, 900)

setElementModel ( player, 29 )

setPlayerNametagColor ( player, 225, 225, 0 )

addEventHandler ( "onPlayerJoin", getRootElement(), assignNewLudzie )

function die ( )

setTimer(spawn, 1800, 1, source)

end

addEventHandler("onPlayerWasted", getRootElement(), die )

so , this was work for me :S

i hope it work for u too :P:wink:

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...