|
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
|
03-05-2017
, 00:55
Re: get player weapons before round end?
|
#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
PHP Code:
GetClientWeapons(client) { new prim, sec; PrimarySlot[client][0] = '\0'; SecondarySlot[client][0] = '\0'; ClientHasWeapons[client] = true; prim = GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY); if (prim > MaxClients) { GetEntityClassname(prim, PrimarySlot[client], sizeof(PrimarySlot[])); } else { Format(PrimarySlot[client], sizeof(PrimarySlot), "NONE"); } sec = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY); if (sec > MaxClients) { GetEntityClassname(sec, SecondarySlot[client], sizeof(SecondarySlot[])); } else { Format(SecondarySlot[client], sizeof(SecondarySlot), "NONE"); } HEGrenades[client] = GetClientHEGrenades(client); FlashBangs[client] = GetClientFlashbangs(client); SmokeGrenades[client] = GetClientSmokeGrenades(client); DecoyGrenades[client] = GetClientDecoyGrenades(client); INCGrenades[client] = GetClientIncendaryGrenades(client); }
GiveClientWeapons(client) { GivePlayerItem(client, "weapon_knife"); if (HEGrenades[client] > 0) { for (new g = 0; g < HEGrenades[client]; g++) { GivePlayerItem(client, "weapon_hegrenade"); } HEGrenades[client] = 0; } if (FlashBangs[client] > 0) { for (new fb = 0; fb < FlashBangs[client]; fb++) { GivePlayerItem(client, "weapon_flashbang"); } FlashBangs[client] = 0; } if (SmokeGrenades[client] > 0) { for (new sg = 0; sg < SmokeGrenades[client]; sg++) { GivePlayerItem(client, "weapon_smokegrenade"); } SmokeGrenades[client] = 0; } if (DecoyGrenades[client] > 0) { for (new dg = 0; dg < DecoyGrenades[client]; dg++) { GivePlayerItem(client, "weapon_decoy"); } DecoyGrenades[client] = 0; } if (INCGrenades[client] > 0) { for (new ig = 0; ig < INCGrenades[client]; ig++) { if (GetClientTeam(client) == CS_TEAM_CT) { GivePlayerItem(client, "weapon_incgrenade"); } else { GivePlayerItem(client, "weapon_molotov"); } } INCGrenades[client] = 0; } if (!StrEqual(SecondarySlot[client], "NONE", false)) { GivePlayerItem(client, SecondarySlot[client]); SecondarySlot[client][0] = '\0'; } if (!StrEqual(PrimarySlot[client], "NONE", false)) { GivePlayerItem(client, PrimarySlot[client]); PrimarySlot[client][0] = '\0'; } }
__________________
Last edited by TnTSCS; 03-05-2017 at 00:57.
|
|
|
|