View Single Post
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 02-18-2020 , 06:38   Re: Random Code Archive
Reply With Quote #30

FindTargetEx:
PHP Code:
int FindTargetEx(int client, const char[] targetint flags 0)
{
    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[1], target_count;
    
bool tn_is_ml;
    
    if ((
target_count ProcessTargetString(targetclienttarget_listsizeof(target_list), COMMAND_FILTER_NO_MULTI flagstarget_namesizeof(target_name), tn_is_ml)) > 0)
    {
        return 
target_list[0];
    }

    
ReplyToTargetError(clienttarget_count);
    return -
1;

ReplyToCommandSource:
PHP Code:
void ReplyToCommandSource(int clientReplySource commandSource, const char[] formatany ...)
{
    
char buffer[254];
    
SetGlobalTransTarget(client);
    
VFormat(buffersizeof(buffer), format4);
    
    
ReplySource currentSource SetCmdReplySource(commandSource);
    
ReplyToCommand(clientbuffer);
    
SetCmdReplySource(currentSource);

ConvertSteamIdIntoAccountId:
PHP Code:
int ConvertSteamIdIntoAccountId(const char[] steamId)
{
    
Regex exp = new Regex("^STEAM_[0-5]:[0-1]:[0-9]+$");
    
int matches exp.Match(steamId);
    
delete exp;
    
    if (
matches != 1)
    {
        return 
0;
    }
    
    return 
StringToInt(steamId[10]) * + (steamId[8] - 48);

__________________

Last edited by Ilusion9; 02-18-2020 at 06:38.
Ilusion9 is offline