Oh sorry hab die falsche *.sma gepostet
Hatte vorher noch bissl selber rumprobiert und einen teil einfach gelöscht es lies sich zwar compilieren aber machte im Spiel keine Anstalten...
Zitat:
Hmmm, würdest Du uns erklären, warum Du 2.50.50 nicht installieren willst?
Jo hatte arge Probs 2.50.50 zu install K.a. lief net also hab ich erstamal die 26er genommen und mit Hilfe Anleitung von adminmod-hilfe.de install
Hier nun die richtige *.sma den Teil den ich einfach gelöscht hatte hab ich mal rot makiert
Code:
/**************************************************************************
* Who, what, why, where, when, how? *
* WHO? Joe "Caveman Noyes *
* WHAT? A replacement for admin_vote_map that allows more than one map *
* nomination, plugin_cavey_votemap.sma v1.3 *
* WHY? Gazbo ran a server called Frog (long story) and at the end of the*
* year he went back to the states with his girlfriend. Lots of 2nd *
* year students remembered his scripts, but they were never on the *
* adminmod plugins download page, so they are now back by popular *
* demand. *
* WHERE?Oh yeah, we are in Exeter University. *
* - http://guild.ex.ac.uk/netgamer *
* WHEN? This was last saved 13:13 13/12/2001 *
* HOW? To install this, compile the script and place it in the dlls *
* directory in CStrike. Then add a line at the TOP of your *
* plugin.ini file that lists the compiled .amx. It MUST go at the *
* top so that it stops the original admin_vote_map from running. *
* Help! ICQ me on 70710878 with any bugs and issues. I will NOT help *
* compiling or installing this plugin as it is all included on *
* - www.adminmod.org *
* or in this file. Enjoy ;) *
* *
* Caveman *
**************************************************************************/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
/*Settings you can screw with*/
#define ACCESS_CANCEL_VOTE 2
/*EXPLANATION Defines what level admin can cancel a vote. */
#define NOMINATION_INTERVAL_SEC 120
/*EXPLANATION Determins how long to allow for more maps to be *
* added */
#define NOMINATION_RETRY_INTERVAL_SEC 30
/*EXPLANATION If a vote fails due to another vote being called *
* it will retry in this many seconds. */
#define MAX_NOMINATIONS 8
/*EXPLANATION The maximum number of maps you will allow to be *
* nominated. NOTE, this CANNOT exceed 8!!!! If you do, you run *
* out of numbers in the vote menu, and do you really need more? */
#define DEBUG 1
/*EXPLANATION Basically, there are a few bits further down that *
* dont add to the script and cause it to bail repeatedly. They *
* are bits from Gazbos original code that I dont think should be *
* necessary, so I removed them through #'s *
* Set to 1 to disable some of the features which may contain bugs*/
#define REMEMBER_MAPS 5
/*EXPLANATION This sets the number of maps it remembers from past *
* votes. The higher you set it, the more it remembers. It will *
* not let you nominate any map that it remembers, so only enable *
* if you are sick of the same few maps. Set it to 0 to disable. */
/*Static global variables*/
new NOMINATIONS_BEGUN_MSG1[] = "Map nominations have begun, map vote starts in 2 minutes."
new NOMINATIONS_BEGUN_MSG2[] = "To nominate a map press the ^"~^", type ^"admin_vote_map <map_name>^", press ^"~^" again"
/*EXPLANATION these are the strings that appear when somone starts*
* a map vote and should be used to explain how to add more maps */
/*Global variables you should NOT screw with!*/
new NominatedMaps[MAX_NOMINATIONS][MAX_NAME_LENGTH];
new NominatedMapsIndex = 0;
new NewMap[MAX_NAME_LENGTH];
new vote_canceled;
#if REMEMBER_MAPS != 0
new RememberedMaps[REMEMBER_MAPS][MAX_NAME_LENGTH]
#endif
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.2";
/*EXPLANATION This resets the map vote array of maps, the number *
* of maps counted in. */
InitializeNominatedMaps() {
new MapCount;
for(MapCount=0;MapCount<MAX_NOMINATIONS;MapCount++) {
NominatedMaps[MapCount][0] = NULL_CHAR;
}
NominatedMapsIndex = 0;
return PLUGIN_HANDLED;
}
/*EXPLANATION THis is the function users can make use of */
public admin_vote_map(HLCommand,HLData,HLUserName,UserIndex) {
new flag = 0;
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new MapCount;
new msg[MAX_TEXT_LENGTH] = "";
new temp[MAX_NAME_LENGTH];
/*Set up the variables*/
convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
for(MapCount=0;MapCount<MAX_NOMINATIONS;MapCount++) {
if (streq(Data,NominatedMaps[MapCount])==1) {
flag=1;
}
}
#if REMEMBER_MAPS != 0
for(MapCount=0;MapCount<REMEMBER_MAPS;MapCount++) {
readfile("lastmaps.ini",RememberedMaps[MapCount],(MapCount+1),MAX_NAME_LENGTH);
if (streq(Data,RememberedMaps[MapCount])==1) {
flag=2;
}
}
#endif
if (vote_allowed()!=1) {
selfmessage( "Vote not allowed at this time.");
return PLUGIN_HANDLED;
} else if (valid_map(Data) != 1) {
selfmessage( "Invalid map name, please try again or use admin_listmaps");
return PLUGIN_HANDLED;
} else if (NominatedMapsIndex >= MAX_NOMINATIONS-1) {
selfmessage("The maximum number of nominations has already been reached.");
return PLUGIN_HANDLED;
} else if (flag==1) {
strcat(msg, "Map already nominated: ", MAX_TEXT_LENGTH);
strcat(msg, Data, MAX_TEXT_LENGTH);
selfmessage(msg);
return PLUGIN_HANDLED;
#if REMEMBER_MAPS != 0
} else if (flag==2) {
strcat(msg, "Map nomination DENIED: ", MAX_TEXT_LENGTH);
strcat(msg, Data, MAX_TEXT_LENGTH);
strcat(msg, " Reason: Won recent vote", MAX_TEXT_LENGTH);
selfmessage(msg);
return PLUGIN_HANDLED;
#endif
} else {
strcpy(NominatedMaps[NominatedMapsIndex],Data, MAX_NAME_LENGTH);
if (NominatedMapsIndex == 0) {
say(NOMINATIONS_BEGUN_MSG1);
say(NOMINATIONS_BEGUN_MSG2);
vote_canceled=0; /*Un-cancels the vote*/
set_timer("VoteOnNominatedMaps",NOMINATION_INTERVAL_SEC,1,"");
}
NominatedMapsIndex++;
strcpy(" ",msg, MAX_TEXT_LENGTH);
numtostr(NominatedMapsIndex,temp);
strcat(msg,temp, MAX_TEXT_LENGTH);
strcat(msg," (", MAX_TEXT_LENGTH);
strcat(msg,Data, MAX_TEXT_LENGTH);
strcat(msg,") has been added by ", MAX_TEXT_LENGTH);
strcat(msg,User, MAX_TEXT_LENGTH);
say(msg);
}
return PLUGIN_HANDLED;
}
/*EXPLANATION Called after the correct time by admin_vote_map and handles the vote *
* It makes the menu using a switch to declare enough variables. Almost all of this*
* was written by Gazbo. For version 1.1 I changed it so that if a map vote is *
* called before the vote occurs, it waits for another NOMINATION_INTERVAL_SEC and *
* delays the vote. Previously, if you vote_kicked duing the runnup time, the vote *
* bailed and you could not use the map vote at all until the next map. Now it *
* should work come rain or shine*/
public VoteOnNominatedMaps () {
new msg[MAX_TEXT_LENGTH] = "Change map to";
new nochange[MAX_TEXT_LENGTH] = "No change of map";
new strNumber[MAX_NUMBER_LENGTH];
new iserror = 0;
if(vote_allowed()!=1) {
say("Vote DELAYED for change map.");
/*If it goes tits up cause someone held a vote, it tries again.*/
set_timer("VoteOnNominatedMaps",NOMINATION_RETRY_INTERVAL_SEC,1,"");
return PLUGIN_HANDLED;
} else if(vote_canceled==1) {
say("Map vote successully canceled");
/*If an admin has canceled the vote, it bails and resets*/
InitializeNominatedMaps();
vote_canceled=0;
return PLUGIN_HANDLED;
} else {
/* NominatedMapsIndex should already be one past the player entered *
* maps, this is okay becaue the nochange option uses a vote option. */
switch(NominatedMapsIndex) {
case 1:
vote(msg,nochange,NominatedMaps[0],"HVoteMap","");
// break;
case 2:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],"HVoteMap","");
// break;
case 3:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],"HVoteMap","");
// break;
case 4:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],NominatedMaps[3],"HVoteMap","");
// break;
case 5:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],NominatedMaps[3],NominatedMaps[4],"HVoteMap","");
// break;
case 6:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],NominatedMaps[3],NominatedMaps[4],NominatedMaps[5],"HVoteMap","");
// break;
case 7:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],NominatedMaps[3],NominatedMaps[4],NominatedMaps[5],NominatedMaps[6],"HVoteMap","");
// break;
case 8:
vote(msg,nochange,NominatedMaps[0],NominatedMaps[1],NominatedMaps[2],NominatedMaps[3],NominatedMaps[4],NominatedMaps[5],NominatedMaps[6],NominatedMaps[7],"HVoteMap","");
// break;
default:
iserror = 1;
}
// It seems the Small compiler has a bug which allows only one
// statement per case.
if(iserror) {
strcpy("Voting CANCLED. Internal script error.",msg, MAX_TEXT_LENGTH);
numtostr(NominatedMapsIndex,strNumber);
strcat(msg, strNumber, MAX_TEXT_LENGTH);
say(msg);
InitializeNominatedMaps();
}
}
return PLUGIN_HANDLED;
}
/*EXPLANATION This function acts on the decision of the vote. The #'s in here*
* contain the code that caused the vote to fail EVERY time. As far as I can*
* tell, it is not needed as the vote has already gone through, but Gazbo *
* included it for some reason. */
public HVoteMap(WinningOption,HLData,VoteCount,UserCount) {
new VoteSubject[MAX_DATA_LENGTH];
new VoteMap[MAX_NAME_LENGTH];
new msg[MAX_TEXT_LENGTH] = "";
new strNumber[MAX_NUMBER_LENGTH];
#if REMEMBER_MAPS != 0
new MapCount;
#endif
// WinningOption == 0 if nothing was vote for.
// WinningOption == 1 referrs to the vote to not change the map.
if (WinningOption==0 || WinningOption==1) {
strcat(VoteSubject,"keeping current map", MAX_TEXT_LENGTH);
} else {
strcpy(VoteMap,NominatedMaps[WinningOption-2], MAX_NAME_LENGTH);
if(valid_map(VoteMap) != 1) {
// This should only happen if "NominatedMapsIndex++;"
// was run but map was not yet added to NominatedMaps,
// and most players voted for the null string map.
// So, in practive, this is very unlikley.
strcat(msg,"Vote IGNORED for ", MAX_TEXT_LENGTH);
strcat(msg,VoteSubject, MAX_TEXT_LENGTH);
strcat(msg,".", MAX_TEXT_LENGTH);
say(msg);
say("An invalid map won the vote.");
InitializeNominatedMaps();
return PLUGIN_HANDLED;
} else {
strcat(VoteSubject,"changing map to ", MAX_TEXT_LENGTH);
strcat(VoteSubject,VoteMap, MAX_TEXT_LENGTH);
}
}
if( vote_canceled!=0 ) {
strcat(msg,"Vote CANCELED for map change by admin", MAX_TEXT_LENGTH);
say(msg);
} else {
strcat(msg,"Vote passed FOR ", MAX_TEXT_LENGTH);
strcat(msg,VoteSubject, MAX_TEXT_LENGTH);
strcat(msg,". ", MAX_TEXT_LENGTH);
say(msg);
msg = "";
strcat(msg,"Map selection based on which recieved the most votes, this one recieved ", MAX_TEXT_LENGTH);
numtostr(VoteCount,strNumber);
strcat(msg,strNumber, MAX_TEXT_LENGTH);
strcat(msg," votes.", MAX_TEXT_LENGTH);
say(msg);
#if REMEMBER_MAPS != 0
resetfile("lastmaps.ini");
writefile("lastmaps.ini",VoteMap,-1);
for(MapCount=1;MapCount<REMEMBER_MAPS;MapCount++) {
writefile("lastmaps.ini",RememberedMaps[MapCount],-1);
}
#endif
if (WinningOption !=0 && WinningOption !=1 && vote_canceled==0 ) {
strcpy(NewMap,VoteMap,MAX_NAME_LENGTH);
/*exec("mp_timelimit 15");*/
set_timer("ChangeMap",10,1);
}
}
InitializeNominatedMaps();
return PLUGIN_HANDLED;
}
public admin_cancelmapvote(HLCommand,HLData,HLUserName,UserIndex) {
new Text[MAX_TEXT_LENGTH];
vote_canceled=1;
snprintf(Text, MAX_TEXT_LENGTH, "Admin attempting to cancel map vote");
say(Text);
return PLUGIN_HANDLED;
}
public ChangeMap() {
if(NewMap[0]!=NULL_CHAR) {
changelevel(NewMap);
}
}
public plugin_init() {
plugin_registerinfo("Caveys Menu Map Vote 1.3","Allows multiple maps to be nominated",STRING_VERSION);
plugin_registercmd("admin_vote_map","admin_vote_map",ACCESS_VOTE_MAP,"admin_vote_map <map>: Starts map nominations before the vote to change the map.");
plugin_registercmd("admin_cancelmapvote","admin_cancelmapvote",ACCESS_CANCEL_VOTE,"admin_cancelmapvote: Cancels the current map vote");
return PLUGIN_CONTINUE;
}
Edit: Huch hier gehen ja garkeine farben inna codeansicht
Code:
if (WinningOption !=0 && WinningOption !=1 && vote_canceled==0 ) {
strcpy(NewMap,VoteMap,MAX_NAME_LENGTH);
/*exec("mp_timelimit 15");*/
set_timer("ChangeMap",10,1);
}
}
InitializeNominatedMaps();
return PLUGIN_HANDLED;
}
THX ! Seth