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

Changing Maps Command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joecaprini
Junior Member
Join Date: Jul 2004
Location: In a blackhole
Old 03-06-2005 , 10:44   Changing Maps Command
Reply With Quote #1

I am writing a plugin where if you say "cm dd2" it will change your map to de_dust2, cm ca is cs_assualt, etc. But what I need is for someone to please tell me how to check a file for the name entered ex. dd2, and check the file for the map it is. Heres an example of the file:

dd2 "de_dust2"
dd2cz "de_dust2_cz"
citalycz "cs_italy_cz"

It will look for the initials you typed and then change the map to the one in the quotes. Can anyone help?
__________________
-JOECAPRINI-
joecaprini is offline
Send a message via AIM to joecaprini
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-06-2005 , 13:23  
Reply With Quote #2

Code:
// somehow grab what they typed in // we'll assume that the variable "foobar" // contains the abbreviated name of the map // the file to read from new file[64]; file = "addons/amxmodx/data/yourfilehere.ini"; // if file does not exist, give up now if(!file_exists(file)) {    return PLUGIN_HANDLED; } // data for reading new line, text[64], txtlen; // go through lines in the file while((line = read_file(file,line,text,63,txtlen)) != 0) {    // abbreviation for this map and the full name    new abbrev[32], mapname[32];    // split the data into the variables    parse(text,abbrev,31,mapname,31);    // get rid of quotes    remove_quotes(mapname);    // if we found a match    if(equali(abbrev,foobar)) {       server_cmd("changelevel %s",mapname); // change the map    }    break; // stop looping } return PLUGIN_HANDLED;
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
joecaprini
Junior Member
Join Date: Jul 2004
Location: In a blackhole
Old 03-06-2005 , 17:07  
Reply With Quote #3

wow thats a lot more compicated than I thought. I'll see if I can figure it out. Thx
__________________
-JOECAPRINI-
joecaprini is offline
Send a message via AIM to joecaprini
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 10:57.


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