• Print

Author Topic: Last Help to Finish Zombie RP Project Version: 1.0  (Read 14595 times)

0 Members and 1 Guest are viewing this topic.

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #15 on: June 12, 2012, 07:42:57 pm »
With the GAS Code i get this error

Code: Lua
  1.  
  2. [gamemodes\zombierp\gamemode\server\main.lua:15] 'do' expected near 'v'
  3. Registering gamemode 'ZombieRP' derived from 'sandbox'
  4. S
  5.  
  6.  

this is the picture of the CODE



I Put the code In ( main.lua )
« Last Edit: June 12, 2012, 07:47:51 pm by Schiaffino »

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #16 on: June 12, 2012, 08:15:00 pm »
With the Antlion Spawn I Get This Error:

Now is working :) , but the gas can still not working D:
« Last Edit: June 12, 2012, 08:27:20 pm by Schiaffino »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #17 on: June 12, 2012, 09:07:28 pm »
With the Antlion Spawn I Get This Error:

Compare line 14 to 18, then look at error.
What's missing? :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #18 on: June 12, 2012, 10:00:14 pm »
I Add the " do " but now appear this error:

Attempted to create unknown entity type ent_mad_fuel!
[gamemodes\zombierp\gamemode\server\main.lua:33] attempt to index global 'loc' (a nil value)
Registering gamemode 'ZombieRP' derived from 'sandbox'

but when i use ulx ent ent_mad_fuel spawn the fuel correctly D:

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #19 on: June 12, 2012, 10:02:35 pm »
paste your code to include the lines giving you errors.

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #20 on: June 12, 2012, 10:09:38 pm »
here is the code:

Code: Lua
  1.  
  2.  
  3. function GascanFunction()
  4.      PrintMessage( HUD_PRINTTALK, "Gas cans have spawned around the map" )
  5.      local cans = ents.FindByClass( "ent_mad_fuel" )
  6.      for k, v in pairs( cans ) do
  7.           v:Remove()
  8.      end
  9.          end
  10.      local locs = { Vector(1014,-1189,-591) , Vector(1076,-1191,-591) }
  11.      for i=1, #locs do
  12.           local ent = ents.Create("ent_mad_fuel")
  13.           ent:SetPos(loc[i])
  14.           ent:Spawn()
  15.      end
  16. timer.Create("eventtimer", 10, 0, GascanFunction) -- i put 10 to test the function
  17.  
  18.  
  19.  

in game JUST On the start show a message on the console... and is this

Attempted to create unknown entity type ent_mad_fuel!
[gamemodes\zombierp\gamemode\server\main.lua:33] attempt to index global 'loc' (a nil value)
Registering gamemode 'ZombieRP' derived from 'sandbox'


thanks mr.president.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #21 on: June 12, 2012, 10:13:19 pm »
you defined the array of Vectors as locs

then you call it in the for loop as loc...



change it from...

Code: [Select]
ent:SetPos(loc[i])

to

Code: [Select]
ent:SetPos(locs[i])

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #22 on: June 12, 2012, 10:19:22 pm »
i do it , and now i receive this code:

[@gamemodes\zombierp\gamemode\server\main.lua:33] Tried to use a NULL entity!
Registering gamemode 'ZombieRP' derived from 'sandbox'




Again... ( Thanks Mr.President For All Your Time )

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #23 on: June 12, 2012, 10:34:20 pm »
It's trying to say that ent is null.. but you define it in line 32.. are you sure that class is valid...

ent_mad_fuel

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #24 on: June 12, 2012, 10:38:44 pm »
addons\Mad Cows Weapons\lua\entities\ent_mad_fuel

Yes :/

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #25 on: June 12, 2012, 10:49:05 pm »
Look i try this code:

Code: Lua
  1.  
  2. function GascanFunction()
  3.      PrintMessage( HUD_PRINTTALK, "Gas cans have spawned around the map" )
  4.      local cans = ents.FindByClass( "ent_mad_fuel" )
  5.      for k, v in pairs( cans ) do
  6.           v:Remove()
  7.      end
  8.      local ent = ents.Create("ent_mad_fuel")
  9.      ent:SetPos(Vector(1184,-1175,-591))
  10.      ent:Spawn()
  11. end
  12. timer.Create("eventtimer", 5, 0, GascanFunction) -- i put 5 to test
  13.  
  14.  

and work's perfectly, but how i can spawn more than 1 ? D:

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #26 on: June 13, 2012, 01:08:09 pm »
i dont know if that's going to overload or overfload the server but:

Code: Lua
  1. function GascanFunction()
  2. PrintMessage( HUD_PRINTTALK, "Gas cans have spawned around the map" )
  3.  
  4. local cans = ents.FindByClass( "ent_mad_fuel" )
  5. for k, v in pairs( cans ) do v:Remove() end
  6. local ent1 = ents.Create("ent_mad_fuel")
  7. local ent2 = ents.Create("ent_mad_fuel")
  8. local ent3 = ents.Create("ent_mad_fuel")
  9. local ent4 = ents.Create("ent_mad_fuel")
  10. local ent5 = ents.Create("ent_mad_fuel")
  11. local ent6 = ents.Create("ent_mad_fuel")
  12. local ent7 = ents.Create("ent_mad_fuel")
  13. local ent8 = ents.Create("ent_mad_fuel")
  14. local ent9 = ents.Create("ent_mad_fuel")
  15. local ent10 = ents.Create("ent_mad_fuel")
  16. local ent11 = ents.Create("ent_mad_fuel")
  17. local ent12 = ents.Create("ent_mad_fuel")
  18. ent1:SetPos(Vector(1184,-1175,-591))
  19. ent2:SetPos(Vector(-922,-1214,-591))
  20. ent3:SetPos(Vector(-137,-38,-591))
  21. ent4:SetPos(Vector(879,-271,-591))
  22. ent5:SetPos(Vector(1982,1221,-591))
  23. ent6:SetPos(Vector(749,1593,-591))
  24. ent7:SetPos(Vector(801,341,-591))
  25. ent8:SetPos(Vector(-244,1073,-591))
  26. ent9:SetPos(Vector(-518,1976,-591))
  27. ent10:SetPos(Vector(214,2603,-591))
  28. ent11:SetPos(Vector(-1066,-821,-591))
  29. ent12:SetPos(Vector(1175,-112,-591))
  30. ent1:Spawn()
  31. ent2:Spawn()
  32. ent3:Spawn()
  33. ent4:Spawn()
  34. ent5:Spawn()
  35. ent6:Spawn()
  36. ent7:Spawn()
  37. ent8:Spawn()
  38. ent9:Spawn()
  39. ent10:Spawn()
  40. ent11:Spawn()
  41. ent12:Spawn()
  42. end
  43. timer.Create("eventtimer", 300, 0, GascanFunction)
  44.  

Works Perfectly :D

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #27 on: June 13, 2012, 03:03:31 pm »
:P No, it will not overload anything. The method I was trying to get to work for you would just make your code cleaner and allow for the addition or more or fewer entities easier but this method works all the same.

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #28 on: June 14, 2012, 10:42:20 am »
hehe thanks Mr.President :)

to avoid opening another ( topic ) i have 2 questions D: ! sorry if i ask to much hehe u.u

*1: how to add random money drop & like 80% probability to drop a ammo type. like ( smg , shotgun , pistol )
*2: about the Antlion's Guard Dead's i have the code Now: Like this:

Code: Lua
  1.  
  2. function MyNPCKilledFunction(victim, killer)
  3. if victim:GetClass() == "npc_antlionguard" then
  4.    PrintMessage ( HUD_PRINTTALK, "* The Antlion Guard "  .. " was killed by " .. killer:GetName().. ".\n" )
  5. end
  6. end
  7. hook.Add( "OnNPCKilled", "MyNPCKilledFunction", MyNPCKilledFunction )
  8.  
  9.  

how i can add that when i kill this npc , give me ( 2.500 money ? )

Thanks !

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Last Help to Finish Zombie RP Project Version: 1.0
« Reply #29 on: June 14, 2012, 10:37:12 pm »
Finished lol it was just a

Code: Lua
  1.     killer:AddMoney(2500)
  2.  

in a few days i post the zombie survival ! =D

  • Print