• LemonadeScript Custom Spawn Points
    28 replies, posted
I am getting this error every time I respawn, ERROR: GAMEMODE:'PlayerSpawn' Failed: LemonadeScript/gamemode/init.lua:260: attempt to index global 'CustomSpawnPoints' (a nil value) The whole section on the Custom Spawn Points is here: [lua]function GM:PlayerSpawn( ply ) if(LEMON.PlayerData[LEMON.FormatSteamID(ply:SteamID())] == nil) then return; end ply:StripWeapons( ); self.BaseClass:PlayerSpawn( ply ) GAMEMODE:SetPlayerSpeed( ply, LEMON.ConVars[ "WalkSpeed" ], LEMON.ConVars[ "RunSpeed" ] ); if( ply:GetNWInt( "deathmode" ) == 1 ) then ply:SetNWInt( "deathmode", 0 ); ply:SetViewEntity( ply ); end -- Reset all the variables ply:ChangeMaxHealth(LEMON.ConVars[ "DefaultHealth" ] - ply:MaxHealth()); ply:ChangeMaxArmor(0 - ply:MaxArmor()); ply:ChangeMaxWalkSpeed(LEMON.ConVars[ "WalkSpeed" ] - ply:MaxWalkSpeed()); ply:ChangeMaxRunSpeed(LEMON.ConVars[ "RunSpeed" ] - ply:MaxRunSpeed()); LEMON.CallHook( "PlayerSpawn", ply ) LEMON.CallTeamHook( "PlayerSpawn", ply ); -- Change player speeds perhaps? local map = game.GetMap(); if( ply:IsCombine() ) then if( CustomCPSpawnPoints[map] ) then local num = math.random( 1, #CustomCPSpawnPoints[map] ); while( num == LastCPSpawn ) do num = math.random( 1, #CustomCPSpawnPoints[map] ); end LastCPSpawn = num; local sp = CustomCPSpawnPoints[map][num]; ply:SetPos( sp.Pos ); ply:SetEyeAngles( sp.Ang ); end else if( CustomSpawnPoints[map] ) then local num = math.random( 1, CustomSpawnPoints[map] ); while( num == LastSpawn ) do num = math.random( 1, CustomSpawnPoints[map] ); end LastSpawn = num; local sp = CustomSpawnPoints[map][num]; ply:SetPos( sp.Pos ); ply:SetEyeAngles( sp.Ang ); end end end [/lua]
[noparse][lua][/lua][/noparse] .
snip, beaten to it.
Thanks, now back to my question. xD
I can't read [lua] tags for some reason, is it defined anywhere else in the script?
Nope, thats the only line in init.lua its used in.
[QUOTE=Horsey;16220776]I can't read [lua] tags for some reason, is it defined anywhere else in the script?[/QUOTE] Get Firefox.
[QUOTE=Nakahashi;16220811]Nope, thats the only line in init.lua its used in.[/QUOTE] Well, is it defined in any other file?
custom_spawnpoints.lua, [lua]function ccGetCPPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ), true );" ); end end concommand.Add( "rp_getcpspawnpoint", ccGetCPPos ); function ccGetPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ) );" ); end end concommand.Add( "rp_getspawnpoint", ccGetPos ); -- Might as well hard code it. CustomSpawnPoints = { } CustomCPSpawnPoints = { } local function AddSpawnPoint( map, pos, ang, cp ) if( not cp ) then if( not CustomSpawnPoints[map] ) then CustomSpawnPoints[map] = { } end else if( not CustomCPSpawnPoints[map] ) then CustomCPSpawnPoints[map] = { } end end local sp = { } sp.Pos = pos; sp.Ang = ang; if( not cp ) then table.insert( CustomSpawnPoints[map], sp ); else table.insert( CustomCPSpawnPoints[map], sp ); end end[/lua]
[lua] 1. function ccGetCPPos( ply, cmd, args ) 2. 3. if( ply:IsSuperAdmin() ) then 4. 5. ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); 6. ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ), true );" ); 7. 8. end 9. 10. end 11. concommand.Add( "rp_getcpspawnpoint", ccGetCPPos ); 12. 13. function ccGetPos( ply, cmd, args ) 14. 15. if( ply:IsSuperAdmin() ) then 16. 17. ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); 18. ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ) );" ); 19. 20. end 21. 22. end 23. concommand.Add( "rp_getspawnpoint", ccGetPos ); 24. 25. -- Might as well hard code it. 26. 27. CustomSpawnPoints = { } 28. CustomCPSpawnPoints = { } 29. 30. local function AddSpawnPoint( map, pos, ang, cp ) 31. 32. if( not cp ) then 33. 34. if( not CustomSpawnPoints[map] ) then 35. 36. CustomSpawnPoints[map] = { } 37. 38. end 39. 40. else 41. 42. if( not CustomCPSpawnPoints[map] ) then 43. 44. CustomCPSpawnPoints[map] = { } 45. 46. end 47. 48. end 49. 50. local sp = { } 51. sp.Pos = pos; 52. sp.Ang = ang; 53. if( not cp ) then table.insert( CustomSpawnPoints[map], sp ); else table.insert( CustomCPSpawnPoints[map], sp ); end end [/lua] fixed
Exactly the same still. The error says it's in init.lua anyway.. Edit: Wow, I really should have mentioned. Line 260 in init.lua is the line 50 in my first post.
[QUOTE=Nakahashi;16232390]Exactly the same still. The error says it's in init.lua anyway..[/QUOTE] Let me try one more [lua] function ccGetCPPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ), true );" ); end end concommand.Add( "rp_getcpspawnpoint", ccGetCPPos ); function ccGetPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ) );" ); end end concommand.Add( "rp_getspawnpoint", print ">>>ANAL SEX FUCKING LOOK RIGHT HERE RETARD <<<" ); -- Might as well hard code it. CustomSpawnPoints = { } CustomCPSpawnPoints = { } local function AddSpawnPoint( map, pos, ang, cp ) if( not cp ) then if( not CustomSpawnPoints[map] ) then CustomSpawnPoints[map] = { } end else if( not CustomCPSpawnPoints[map] ) then CustomCPSpawnPoints[map] = { } end end local sp = { } sp.Pos = pos; sp.Ang = ang; if( not cp ) then table.insert( CustomSpawnPoints[map], sp ); else table.insert( CustomCPSpawnPoints[map], sp ); end end [/lua]
Still didn't change a thing.
[QUOTE=Nakahashi;16232676]Still didn't change a thing.[/QUOTE] look at the script quick just look through it quick the one that i jst showed you
I read the anal sex part, lol'd. But the command is unregistered.
[QUOTE=Nakahashi;16232717]I read the anal sex part, lol'd. But the command is unregistered.[/QUOTE] lol thats what i was trying to show u :P but i thought i did actually fix it :/
xD nope. The error is in init.lua. The file you just tried to edit and change was custom_spawnpoints.lua, and there are no errors there.
[QUOTE=Nakahashi;16232832]xD nope. The error is in init.lua. The file you just tried to edit and change was custom_spawnpoints.lua, and there are no errors there.[/QUOTE] show me init lua...
It's in my first post.
[lua]function ccGetCPPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( \"" .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ), true );" ); end end concommand.Add( "rp_getcpspawnpoint", ccGetCPPos ); function ccGetPos( ply, cmd, args ) if( ply:IsSuperAdmin() ) then ply:PrintMessage( 2, "AddSpawnPoint( " " .. game.GetMap() .. "\", Vector( " .. ply:GetPos().x .. ", " .. ply:GetPos().y .. ", " .. ply:GetPos().z .. " ), " ); ply:PrintMessage( 2, "Angle( " .. ply:EyeAngles().pitch .. ", " .. ply:EyeAngles().yaw .. ", " .. ply:EyeAngles().roll .. " ) );" ); end end concommand.Add( "rp_getspawnpoint", ccGetPos ); -- Might as well hard code it. CustomSpawnPoints = { } CustomCPSpawnPoints = { } local function AddSpawnPoint( map, pos, ang, cp ) if( not cp ) then if( not CustomSpawnPoints[map] ) then CustomSpawnPoints[map] = { } end else if( not CustomCPSpawnPoints[map] ) then CustomCPSpawnPoints[map] = { } end end local sp = { } sp.Pos = pos; sp.Ang = ang; if( not cp ) then table.insert( CustomSpawnPoints[map], sp ); else table.insert( CustomCPSpawnPoints[map], sp ); end end[/lua]
That's still custom_spawnpoints.lua. XD
[QUOTE=Nakahashi;16233028]That's still custom_spawnpoints.lua. XD[/QUOTE] that was your op... ..|..
No it wasn't. Lol.
[QUOTE=Nakahashi;16233292]No it wasn't. Lol.[/QUOTE] Actually look at your op stupid. ,,/,, ..|..
Lmao, alright.
[QUOTE=Nakahashi;16233471]Lmao, alright.[/QUOTE] ^-^
Compare what you just posted to the first post, can you please try to help meh now? xD
[QUOTE=Nakahashi;16239763]Compare what you just posted to the first post, can you please try to help meh now? xD[/QUOTE] [lua]# function GM:PlayerSpawn( ply ) # # if(LEMON.PlayerData[LEMON.FormatSteamID(ply:SteamID())] == nil) then # return; # end # # ply:StripWeapons( ); # # self.BaseClass:PlayerSpawn( ply ) # # GAMEMODE:SetPlayerSpeed( ply, LEMON.ConVars[ "WalkSpeed" ], LEMON.ConVars[ "RunSpeed" ] ); # # if( ply:GetNWInt( "deathmode" ) == 1 ) then # # ply:SetNWInt( "deathmode", 0 ); # ply:SetViewEntity( ply ); # # end # # -- Reset all the variables # ply:ChangeMaxHealth(LEMON.ConVars[ "DefaultHealth" ] - ply:MaxHealth()); # ply:ChangeMaxArmor(0 - ply:MaxArmor()); # ply:ChangeMaxWalkSpeed(LEMON.ConVars[ "WalkSpeed" ] - ply:MaxWalkSpeed()); # ply:ChangeMaxRunSpeed(LEMON.ConVars[ "RunSpeed" ] - ply:MaxRunSpeed()); # # LEMON.CallHook( "PlayerSpawn", ply ) # LEMON.CallTeamHook( "PlayerSpawn", ply ); -- Change player speeds perhaps? # # local map = game.GetMap(); # if( ply:IsCombine() ) then # if( CustomCPSpawnPoints[map] ) then # # local num = math.random( 1, #CustomCPSpawnPoints[map] ); # # while( num == LastCPSpawn ) do # # num = math.random( 1, #CustomCPSpawnPoints[map] ); # # end # # LastCPSpawn = num; # # local sp = CustomCPSpawnPoints[map][num]; # # ply:SetPos( sp.Pos ); # ply:SetEyeAngles( sp.Ang ); # # end # else # if( CustomSpawnPoints[map] ) then # # local num = math.random( 1, CustomSpawnPoints[map] ); # # while( num == LastSpawn ) do # # num = math.random( 1, CustomSpawnPoints[map] ); # # end # # LastSpawn = num; # # local sp = CustomSpawnPoints[map][num]; # # ply:SetPos( sp.Pos ); # ply:SetEyeAngles( sp.Ang ); # # end # end # # end [/lua]
Late reply, but same error.
Sorry, you need to Log In to post a reply to this thread.