Raised This Month: $ Target: $400
 0% 

[HELP] If Mapname Then Give Wep + Ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 04-22-2018 , 08:54   Re: [HELP] If Mapname Then Give Wep + Ammo
Reply With Quote #1

Try this:
Code:
new LoadFile[128], DataDir[64]; get_datadir(DataDir, charsmax(DataDir)); format(LoadFile, charsmax(LoadFile), "%s/map_data.dat", DataDir); stock add_map(mapname[], value){     new Save[64];     format(Save, charsmax(Save), "^"%s^" %d", mapname, value);     new FileOpen = fopen(LoadFile, "rt"):     if(FileOpen)         write_file(LoadFile, Save);     fclose(FileOpen); } stock get_value_from_data(mapname[]){     new Line[64], Argue1[32], Argue2[10], ReturnValue;     new FileOpen = fopen(LoadFile, "rt");     while(!feof(FileOpen)){         fgets(FileOpen, Line, charsmax(Line));         trim(Line);         parse(Line, Argue1, charsmax(Argue1), Argue2, charsmax(Argue2));         if(equali(Argue1, mapname){             ReturnValue = str_to_num(Argue2);             break;         }     }     fclose(FileOpen);     return ReturnValue: }
__________________

Last edited by Relaxing; 04-22-2018 at 09:12.
Relaxing is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 04-22-2018 , 09:24   Re: [HELP] If Mapname Then Give Wep + Ammo
Reply With Quote #2

Quote:
Originally Posted by Relaxing View Post
Try this:
Code:
new LoadFile[128], DataDir[64]; get_datadir(DataDir, charsmax(DataDir)); format(LoadFile, charsmax(LoadFile), "%s/map_data.dat", DataDir); stock add_map(mapname[], value){     new Save[64];     format(Save, charsmax(Save), "^"%s^" %d", mapname, value);     new FileOpen = fopen(LoadFile, "rt"):     if(FileOpen)         write_file(LoadFile, Save);     fclose(FileOpen); } stock get_value_from_data(mapname[]){     new Line[64], Argue1[32], Argue2[10], ReturnValue;     new FileOpen = fopen(LoadFile, "rt");     while(!feof(FileOpen)){         fgets(FileOpen, Line, charsmax(Line));         trim(Line);         parse(Line, Argue1, charsmax(Argue1), Argue2, charsmax(Argue2));         if(equali(Argue1, mapname){             ReturnValue = str_to_num(Argue2);             break;         }     }     fclose(FileOpen);     return ReturnValue: }
Looks very nice and surely works great.
But I'm sorry to say this is way too advanced for me.
I would love to understand, seems very complex.
I'm not sure how to integrate this.

Thanks.
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 04-22-2018 at 09:24.
GoldNux is offline
Reply



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 04:44.


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