How to change amount of blocks and question about revive

Installation support, coding tips, and general tutorials.
3 posts Page 1 of 1 First unread post
FrozenHeart
Deuce
Posts: 8
Joined: Sat Jun 29, 2013 9:11 pm


Hi, guys!

I have two questions regarding to PySnip / pyspades scripts.

1. How can i change the amount of blocks for the given player without refilling all weapons and grenades? self.blocks = 50 doesn't work for me. While this actually sets blocks instance variable to 50, this value will not affect the GUI's value and when it reaches 0, we can't place blocks anymore. I want to give the player an infinite amount of blocks in some cases.

2. I want to write a script with ability to revive players.
Code: Select all
def on_position_update(self):
    x, y, z = self.get_location()
    for player in self.protocol.players.values():
        xa, ya, za = player.get_location()
        if self.team == player.team and 5 > xa-x > -5 and 5 > ya-y > -5 and 5 > za-z > -5:
            if player.hp is None:
                player.spawn(player.get_location())
    return connection.on_position_update(self)
Yes, the player will revived, but the game's respawn counter will not change and when it reaches 0, the player will be moved to the spawn location again. What can i do to change this effect?
FrozenHeart
Deuce
Posts: 8
Joined: Sat Jun 29, 2013 9:11 pm


Ok, second question is already answered.
FrozenHeart
Deuce
Posts: 8
Joined: Sat Jun 29, 2013 9:11 pm


I think that it might be possible by refilling all items and then restore prev. values for weapon and grenades like in the following code:
Code: Select all
weapon = self.weapon_object
prev_ammo = weapon.current_ammo
prev_stock = weapon.current_stock
self.refill()
weapon.current_ammo = prev_ammo
weapon.current_stock = prev_stock
weapon_reload.player_id = self.player_id
weapon_reload.clip_ammo = prev_ammo
weapon_reload.reserve_ammo = prev_stock
self.send_contained(weapon_reload)
But i don't know how to change the amount of grenades. Any ideas?
3 posts Page 1 of 1 First unread post
Return to “Help!”

Who is online

Users browsing this forum: No registered users and 3 guests