Raised This Month: $ Target: $400
 0% 

Events id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 07-09-2018 , 13:12   Events id
Reply With Quote #1

Event
PHP Code:
new weapon_name[32]
read_data(4weapon_name31)            
            
if(
containi(weapon_name"ak47") != -1InsertWeaponKill(CSW_AK47);
else if(
containi(weapon_name"m4a1") != -1InsertWeaponKill(CSW_M4A1); 
mySQL
PHP Code:
public InsertWeaponKill(wpnindex)
{
    new 
szQuery[3800];
    
    
formatexszQuery3799"INSERT INTO `wipon` (`gun_id`, `kills`) VALUES (%d, 1) ON DUPLICATE KEY UPDATE `kills` = `kills` + 1;"wpnindex);
    
    
log_amx(szQuery)
    
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);

If someone kills someone with AK47 then value goes up +1.
But i would like to find the killers steam id and write it to database. Steam id + gun id + kills.
Everything works fine with the old code but it counts total amount of kills by that specific gun. I need that it counts by specific steam id.
Is it possible?

I was thinking something like this. I know its not correct coded but its just an idea.

PHP Code:
public InsertWeaponKill(wpnindex)
{
    
    new 
steam[64];    
    
get_user_authid(idsteam63);
    
    static 
szQuery[3800];
    
formatexszQuery3799"INSERT INTO `wipon` (`player_id`, `gun_id`, `kills`) VALUES ('%s', '%d', 1', NOW());"steamwpnindexON DUPLICATE KEY UPDATE `kills` = `kills` + 1);
    
    
SQL_ThreadQueryg_hTuple"QuerySetData"szQuery);

    return 
PLUGIN_CONTINUE;


Last edited by 4ever16; 07-09-2018 at 13:42.
4ever16 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-09-2018 , 13:31   Re: Events id
Reply With Quote #2

You need to cache all kills and deaths etc, and when map end or client_disconnect make the updates;
Also consider to use csx module to get client_kill and other things more easily than compare strings
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply



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 12:42.


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