Raised This Month: $51 Target: $400
 12% 

Solved ArrayPushArray problems


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 06-21-2020 , 07:37   ArrayPushArray problems
Reply With Quote #1

Hello,
I tried to make a VIP Plugin with a vips.ini file for reading vips.
But when I introduce the data in file, it not shows me exactly what I wanna get from that array.

Code:
Code:
public CheckVIP() {     new path[64];     get_localinfo("amxx_configsdir", path, charsmax(path));     format(path, charsmax(path), "%s/vips.ini", path);         new file = fopen(path, "r+");         if(!file_exists(path))     {         write_file(path, ";VIPs.ini file");     }         if(vips_number)     {         ArrayClear(vip_array);         vips_number = 0;     }         new text[121], p_name[32], expir_date[32], vip_infos[vip_data];     while(!feof(file))     {         fgets(file, text, charsmax(text));         trim(text);                 if(text[0] == ';' || !strlen(text))         {             continue;         }                 if(parse(text, p_name, charsmax(p_name), expir_date, charsmax(expir_date)) != 2)         {             log_to_file(LOGFILE, "[AMXX] Can't (%s). Este scrisa gresit.", text);             continue;         }                 copy(vip_infos[user_name], charsmax(vip_infos), p_name);         copy(vip_infos[expire_date], charsmax(vip_infos), expir_date);
        ArrayPushArray(vip_array, vip_infos);
        vips_number++;     }         fclose(file); }

putinserver client phase:

Code:
public client_putinserver(id) { new p_name[32];     get_user_info(id, "name", p_name, charsmax(p_name));     is_user_vip[id] = false;     new vip_infos[vip_data], i;         for(i = 0; i < ArraySize(vip_array); i++)     {         ArrayGetArray(vip_array, i, vip_infos);         if(equal(vip_infos[user_name], p_name))         {             is_user_vip[id] = true;             set_task(10.0, "Task_ShowExpire")         }         break;     } }

Show Expire Task:
Code:
public Task_ShowExpire(id) {     new vip_infos[vip_data]     for(new i = 0; i < ArraySize(vip_array); i++)     {         ArrayGetArray(vip_array, i, vip_infos);     }     color_chat(id, "!y[!gV.I.P!y] Your !gVIP Status !yExpire on: !g%s", vip_infos[expire_date]) }

vips.ini file:
Code:
"Adi" "Permanent VIP" "Test" "30.06.2020"
In the public Task_ShowExpire it prints me the value from the last Array from the file. Example:
Adi is joining the server. Adi has VIP and server prints his vip's expire is on "30.06.2020" instead to print "Permanent VIP"
Test is joining the server. Test has not VIP, but he is written in the file.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 06-21-2020 at 12:02.
Shadows Adi is offline
 



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 00:43.


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