Quote:
Originally Posted by splewis
Good question. I've experimented with some things, but haven't really gotten anything working.
I believe I tried running that plugin with the multi1v1 plugin on my private server and it began crashing when there were multiple players on the server - similar things happened when I tried to give the other types of knifes.
A related issue is the p2k/usp weirdness. You get whichever one you selected in the menu on T, but you get your inventory-selected one on CT. Oddly enough, the same doesn't happen with M4 choices. You always get the one you selected in the guns menu.
A brief look at h3bus' deathmatch plugin made me suspect getting all the kinks with weapons worked out may be a relatively involved task.
The weapon-giving logic is <20 lines right now ( https://github.com/splewis/csgo-mult...atives.sp#L121), and I imagine it might have to get a whole lot longer to get that stuff added.
|
My code can be really harsh as it uses a lot of internal method for handling weapon, but this is not that hard.
In fact what happen there is that:
- if you are trying to give a weapon that has two possibilities for one loadout slot (eg: p2000/usp)
- and if the slot is defined for the current team of the player your giving the weapon
then the game will give the weapon (and skin) that is selected by the loadout slot.
However if you are CT and receiving an Ak, you won't get your skin.
Thus my logic when I give a weapon:
- I have a DB which tells me on which team a weapon is available in loadout (possible values T/CT/Both)
- If current player's team is not equal to the DB, I change its team props (This can be done without actually switching the team if player is set back to its actual team before the next frame, otherwise server may crash)
- I give the weapon
- As the weapon might be overriden by loadout slot (eg P2000/USP), I check the the given weapon definition index matches the expected one. If not, I switch again the team so that player will get the expected weapon (with no skin), then kill the badly given weapon and give it again.
- I switch back the player to its original team.