Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup Player Grenades for SAPP
- -- by H® Shaft
- -- Allows server admins to set number of frag and plasma grenades per map, assigned when player spawns.
- -- See line 42 - load tables to modify the grenade counts you prefer per map, and to add maps.
- -- WILL work with stock pc and custom CE maps
- -- sapp api version
- api_version = "1.8.0.0"
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnNewGame")
- register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
- map_name = get_var(0,"$map")
- Load_Tables()
- end
- function OnScriptUnload()
- frag_count = {}
- plasma_count = {}
- end
- function OnNewGame()
- map_name = get_var(0,"$map")
- Load_Tables()
- end
- function GameEnd()
- game_started = false
- end
- function OnPlayerSpawn(PlayerIndex)
- if player_alive(PlayerIndex) then
- local player_object = get_dynamic_player(PlayerIndex)
- safe_write(true)
- write_word(player_object + 0x31E, frag_count[map_name])
- write_word(player_object + 0x31F, plasma_count[map_name])
- safe_write(false)
- end
- end
- function Load_Tables()
- -- specify the number of frag grenades when player spawns
- -- each map in this table, must be separated with a comma
- -- map name # count
- frag_count = {
- beavercreek = 2,
- beavercreek = 0,
- bloodgulch = 2,
- boardingaction = 2,
- carousel = 1,
- chillout = 0,
- damnation = 1,
- dangercanyon = 2,
- deathisland = 4,
- gephyrophobia = 2,
- hangemhigh = 1,
- icefields = 2,
- infinity = 4,
- longest = 1,
- prisoner = 2,
- putput = 0,
- ratrace = 1,
- sidewinder = 2,
- timberland = 2,
- wizard = 1,
- }
- -- specify the number of plasma grenades when player spawns
- -- map name # count
- plasma_count = {
- beavercreek = 0,
- bloodgulch = 2,
- boardingaction = 2,
- carousel = 1,
- chillout = 0,
- damnation = 1,
- dangercanyon = 2,
- deathisland = 4,
- gephyrophobia = 2,
- hangemhigh = 1,
- icefields = 2,
- infinity = 4,
- longest = 1,
- prisoner = 2,
- putput = 2,
- ratrace = 1,
- sidewinder = 2,
- timberland = 2,
- wizard = 1,
- }
- end
- -- Created by H® Shaft
- -- Visit Visit http://halorace.org/forum/index.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement