Raised This Month: $32 Target: $400
 8% 

get player weapons before round end?


Post New Thread Reply   
 
Thread Tools Display Modes
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2017 , 05:20   Re: get player weapons before round end?
Reply With Quote #11

Can you just edit my code and tell me how? i just got so confused testing different methods and still nothing.
__________________
ambn is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2017 , 05:46   Re: get player weapons before round end?
Reply With Quote #12

This is how i did it:
Spoiler
__________________

Last edited by ambn; 03-03-2017 at 05:59.
ambn is offline
c00lio
Junior Member
Join Date: Feb 2017
Old 03-03-2017 , 07:14   Re: get player weapons before round end?
Reply With Quote #13

Quote:
Originally Posted by OSWO View Post
Slot 0 = Primary, why do you exactly not want to check the Primary Slot?
In his code, doesn't use slot = 0 at all but starts from 0

Last edited by c00lio; 03-03-2017 at 07:15.
c00lio is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-03-2017 , 11:13   Re: get player weapons before round end?
Reply With Quote #14

Here's what I PERSONALLY would've done, just note I am not the top diggity dog around here.
To me, it's more readable and edit friendly if you loop through clients and pass each client index individually whenever you are to call GetClientWeapons() and GiveClientWeapons().
My Rendition of the Stocks:


so instead of
My Examples in play

Last edited by sdz; 03-03-2017 at 11:14.
sdz is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2017 , 11:29   Re: get player weapons before round end?
Reply With Quote #15

well thank you for your replay it seems very clean , so i'm gonna test this now.
__________________
ambn is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2017 , 12:29   Re: get player weapons before round end?
Reply With Quote #16

I used GetClientWeapons(client) on cs_pre_restart event then fired GiveClientWeapons(client) with a timer after 0.5 seconds on round start but nothing happens ...
__________________

Last edited by ambn; 03-03-2017 at 12:30.
ambn is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-03-2017 , 14:17   Re: get player weapons before round end?
Reply With Quote #17

Run some debugging, check values every step of the way. Make sure your cs_pre_restart event is even firing. Lots you can do. Perhaps increase that timer to 1.0-1.5 to compensate for player lag?
Also, it looks like you wanted to give weapons, so this is what I would personally do..

PHP Code:

int playerWeapons
[MAXPLAYERS 1][5];
char weaponClass[MAXPLAYERS 1][5][32];

stock void GetClientWeapons(int client)
{
    for(
int slot 0slot <= 4slot++)
    {
        if(
IsClientInGame(client) && IsPlayerAlive(client))
        {
            if(
playerWeapons[client][slot] = GetPlayerWeaponSlot(clientslot) > -1)
            {
                
GetEdictClassname(playerWeapons[client][slot], weaponClass[client][slot], 32);
            }
            else 
weaponClass[client][slot] = "";
        }
    }
}

stock void GiveClientWeapons(int client)
{
    for(
int slot 0slot <= 4slot++)
    {
        if(
IsClientInGame(client) && IsPlayerAlive(client))
        {
            if(
playerWeapons[client][slot] > -1)
            {
                
GivePlayerItem(clientweaponClass[client][slot]);
            }
        }
    }


Last edited by sdz; 03-04-2017 at 14:11.
sdz is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2017 , 14:42   Re: get player weapons before round end?
Reply With Quote #18

I'll test it tomorrow and thank you for helping me getting this work , it would be awesome if we can talk on steam if possible, add me if possible and again thank you.
__________________
ambn is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 03-05-2017 , 00:55   Re: get player weapons before round end?
Reply With Quote #19

In the Zeus Round plugin, there is a section where I get and store the player's weapons and then give them back to them later. You can take a look at that and see if that code helps get you to where you want to go.

Here's a snippet of that plugin pertaining to weapons
Spoiler
__________________
View my Plugins | Donate

Last edited by TnTSCS; 03-05-2017 at 00:57.
TnTSCS is offline
sdz
Senior Member
Join Date: Feb 2012
Old 03-05-2017 , 11:07   Re: get player weapons before round end?
Reply With Quote #20

Already solved this with the OP, sorry if anyone wasted massive time writing snippets
sdz is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode