View Single Post
McSnaggit
Junior Member
Join Date: Feb 2019
Old 03-26-2019 , 08:47   Re: Enum or array inside query callback
Reply With Quote #8

So the above code is OK? Or should I send it to the callback and after sending in the same function close it again?

So like this:

PHP Code:

public void SQL_Insert_Death(Database dbDBResultSet results, const char[] errorDataPack hEventInfo) {
  
  
hEventInfo.Reset(); // reset datapack pos, you need to do this before reading a datapack 
  
  
char type[32]; hEventInfo.ReadString(typesizeof(type)); // "kill"
  
char weapon[32]; hEventInfo.ReadString(weaponsizeof(weapon)); // "ak47"
  
char killerTeam[32]; hEventInfo.ReadString(killerTeamsizeof(killerTeam)); // "T"
  
char victimTeam[32]; hEventInfo.ReadString(victimTeamsizeof(victimTeam)); // "CT"
  
int iNumber hEventInfo.ReadCell(); // 1920394

  //Create Type
  
char createTypeQuery[256]; FormatEx(createTypeQuerysizeof(createTypeQuery), "INSERT INTO types (name) VALUES ('%s');"eventDetail);
  
db.Query(SQL_Create_TypecreateTypeQueryhEventInfo);

  
// make sure to close the datapack handle
  
delete hEventInfo;

Or just close it after I use it for the last time?
McSnaggit is offline