Raised This Month: $ Target: $400
 0% 

Events id


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


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


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