Raised This Month: $ Target: $400
 0% 

Solved it keep just print 1, whatever which weapon i'm handling


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
zonbarbar
Member
Join Date: Jul 2022
Old 07-25-2023 , 11:37   it keep just print 1, whatever which weapon i'm handling
Reply With Quote #1

i don't know how is this going, any another better way to make this happen?

code:
public Action CheckPlayerWeapon(Handle timer)
{

for(int client = 1; client <= MaxClients; client++)
{

if(IsSurvivor(client) && IsPlayerAlive(client) && !IsFakeClient(client))
{

int weapon = GetPlayerWeaponSlot(client, 0);
if (weapon == -1)
{
return Plugin_Continue;
}

char weaponClass[32];
GetEdictClassname(weapon, weaponClass, sizeof(weaponClass));

if(StrEqual(weaponClass, "weapon_smg_mp5")||(weaponClass, "weapon_rifle")||(weaponClass, "weapon_sniper_military"))
{
PrintToChat(client, "1");
}
else if(StrEqual(weaponClass, "weapon_rifle_desert")||(weaponClass, "weapon_sniper_awp")||(weaponClass, "weapon_shotgun_spas"))
{
PrintToChat(client, "2");
}
else if(StrEqual(weaponClass, "weapon_smg")||(weaponClass, "weapon_rifle_ak47")||(weaponClass, "weapon_shotgun_chrome"))
{
PrintToChat(client, "3");
}
else if(StrEqual(weaponClass, "weapon_autoshotgun")||(weaponClass, "weapon_sniper_scout")||(weaponClass, "weapon_rifle_sg552"))
{
PrintToChat(client, "4");
}
else if(StrEqual(weaponClass, "weapon_hunting_rifle")||(weaponClass, "weapon_smg_silenced")||(weaponClass, "weapon_pumpshotgun"))
{
PrintToChat(client, "5");
}
else
{
PrintToChat(client, "6");
}
return Plugin_Continue;
}
return Plugin_Continue;
}
return 0;
}

Last edited by zonbarbar; 07-25-2023 at 13:45.
zonbarbar is online now
 



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 21:23.


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