View Single Post
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 08-09-2019 , 08:49   Re: Passing string to CreateTimer Function
Reply With Quote #8

Maybe there is more efficient method, but this should work

PHP Code:
#define STEAMID_CHARSTR_LENGTH 25

...(...)
{
    
char steamid[STEAMID_CHARSTR_LENGTH];
    if(
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid))) 
    {
        
DataPack pack;
        
        
CreateDataTimer(2.0saveBanpack);
        
        for(
int i 0STEAMID_CHARSTR_LENGTH; ++i)
        {
            
pack.WriteCell(view_as<int>(steamid[i]));
        }
    }
}
public 
Action saveBan(Handle timerDataPack pack
{
    
pack.Reset();
    
char steamid[STEAMID_CHARSTR_LENGTH];
    for(
int i 0STEAMID_CHARSTR_LENGTH; ++i)
    {
        
steamid[i] = view_as<char>(pack.ReadCell());
    }
    
    
//done

__________________
impossible_cc is offline