hi ..ich habe versucht einfach die verbotenen 4 letzten maps auf 5 bzw. 6 zu erweitern leider bekomme ich beim kompilieren immer fehler meldung ..kanste mir da weiter helfen?
code:
Code:
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
new AM_VERSION_STRING[] = "2.50.58_v081";
/************************************************************/
/* KANN ENTSPRECHEND EDITIERT UND DANN NEU KOMPILIERT WERDEN*/
/************************************************************/
/*Nominate settings*/
new g_setnominatetime = 60;
new g_setnominatewarntime = 15;
new g_setvotetime = 30;
/************************************************************/
/*Vote*/
new g_LastMaps[5][MAX_NAME_LENGTH];
new g_NominatedMaps[9][MAX_NAME_LENGTH];
new g_suggestions;
new g_votestart;
new g_nominatetime;
new g_vote_canceled;
/*Sounds*/
new g_VoteWarn[MAX_TEXT_LENGTH];
new g_VoteNow[MAX_TEXT_LENGTH];
new g_VoteFailed[MAX_TEXT_LENGTH];
new g_VotePassed[MAX_TEXT_LENGTH];
/*Menu*/
new g_UserVoteMenu[MAX_PLAYERS];
new g_UserSelect[MAX_PLAYERS];
/*Map-Settings*/
new g_CurrentMap[MAX_NAME_LENGTH];
new g_NextMap[MAX_NAME_LENGTH];
new g_curextend;
new g_maxextend;
new g_origtimelimit;
new g_newtimelimit;
public plugin_init() {
plugin_registerinfo("Map-Nomination-Plugin","Mapnominierung im Chat mit anschließendem Vote",AM_VERSION_STRING);
plugin_registercmd("admin_vote_nominate","start_nominate",ACCESS_VOTE_MAP,"admin_vote_nominate: starts map-nomination and vote");
plugin_registercmd("admin_vote_restrict","del_maprestrict",ACCESS_VOTE_MAP,"admin_vote_restrict <[1]>: displays restricted maps, 1=allows to nominate every map");
plugin_registercmd("admin_vote_stop","stop_vote",ACCESS_VOTE_MAP,"admin_vote_stop: stops map-nomination and vote");
plugin_registercmd("say","HandleSay",ACCESS_ALL,"vote mapname: make suggestions for mapchange");
plugin_registercmd("menuselect","menuselect",ACCESS_ALL);
plugin_registercmd("radio1","SetMenuData",ACCESS_ALL);
plugin_registercmd("radio2","SetMenuData",ACCESS_ALL);
plugin_registercmd("radio3","SetMenuData",ACCESS_ALL);
plugin_registercmd("buyequip","SetMenuData",ACCESS_ALL);
plugin_registercmd("buy","SetMenuData",ACCESS_ALL);
plugin_registercmd("chooseteam","SetMenuData",ACCESS_ALL);
plugin_registercmd("showbriefing","SetMenuData",ACCESS_ALL);
/*Map-Settings*/
currentmap(g_CurrentMap,MAX_NAME_LENGTH);
nextmap(g_NextMap,MAX_NAME_LENGTH);
g_maxextend=getvar("admin_vote_maxextend");
g_origtimelimit=getvar("mp_timelimit");
g_newtimelimit=g_origtimelimit;
/*Alte Maprestriktion laden*/
get_vaultdata("VFI_NOMINATE_LASTMAP1",g_LastMaps[0],MAX_NAME_LENGTH);
get_vaultdata("VFI_NOMINATE_LASTMAP2",g_LastMaps[1],MAX_NAME_LENGTH);
get_vaultdata("VFI_NOMINATE_LASTMAP3",g_LastMaps[2],MAX_NAME_LENGTH);
get_vaultdata("VFI_NOMINATE_LASTMAP4",g_LastMaps[3],MAX_NAME_LENGTH);
get_vaultdata("VFI_NOMINATE_LASTMAP5",g_LastMaps[4],MAX_NAME_LENGTH);
/*Neue Maprestriktion für die nächsten Map speichern*/
set_vaultdata("VFI_NOMINATE_LASTMAP1",g_LastMaps[1]);
set_vaultdata("VFI_NOMINATE_LASTMAP2",g_LastMaps[2]);
set_vaultdata("VFI_NOMINATE_LASTMAP3",g_LastMaps[3]);
set_vaultdata("VFI_NOMINATE_LASTMAP4",g_LastMaps[4]);
set_vaultdata("VFI_NOMINATE_LASTMAP5",g_CurrentMap);
/*Sounds laden*/
get_vaultdata( "VFI_VOTEWARN", g_VoteWarn, MAX_TEXT_LENGTH );
get_vaultdata( "VFI_VOTENOW", g_VoteNow, MAX_TEXT_LENGTH );
get_vaultdata( "VFI_VOTEPASSED", g_VotePassed, MAX_TEXT_LENGTH );
get_vaultdata( "VFI_VOTEFAILED", g_VoteFailed, MAX_TEXT_LENGTH );
return PLUGIN_CONTINUE;
}
allowsound(User[]){
new Key[]="am_sound";
new Info[MAX_NUMBER_LENGTH];
new iInfo;
new Authid[MAX_AUTHID_LENGTH];
get_userAuthID(User,Authid,MAX_AUTHID_LENGTH);
if(strcmp(Authid,"BOT")!=0){
get_userinfo(User,Key,Info,MAX_NUMBER_LENGTH);
iInfo=strtonum(Info);
if(strlen(Info)==0 || iInfo > 0){/*damit wird automatisch immer der Sound auf 1 gesetzt,wenn kein setinfo vorhanden, bis 'stop' eingegeben wird*/
return 1;
}
}
return 0;
}
sound_all(Sound[]){
new Name[MAX_NAME_LENGTH];
new maxplayers = maxplayercount();
new i;
for(i=1;i<=maxplayers; i++ ){
if( playerinfo(i, Name, MAX_NAME_LENGTH)){
if(allowsound(Name)==1){
playsound(Name,Sound);
}
}
}
}
public stop_vote(HLCommand,HLData,HLUserName,UserIndex){
g_vote_canceled=1;
selfmessage("[VFI-NOMINATE]: Manominierung und Vote abgebrochen!");
return PLUGIN_HANDLED;
}
public del_maprestrict(HLCommand,HLData,HLUserName,UserIndex){
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
new i;
convert_string(HLData,Data,MAX_DATA_LENGTH);
if(Data[0]=='1'){
for(i=0;i<=5;i++){
strinit(g_LastMaps[i]);
selfmessage("[VFI-NOMINATE]: Maprestriktion fuer diese Map aufgehoben!");
}
}else{
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Ausgeschlossene Maps sind:^n%s %s %s %s %s",g_LastMaps[0],g_LastMaps[1],g_LastMaps[2],g_LastMaps[3],g_LastMaps[4]);
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
public start_nominate(HLCommand,HLData,HLUserName,UserIndex){
new Text[MAX_TEXT_LENGTH];
if(!g_nominatetime && !g_votestart){
sound_all(g_VoteNow);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]:^nGebt Eure Mapvorschlaege^nim Chat ab!");
centersay(Text,12,255,255,255);
g_nominatetime=g_setnominatetime;
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-VOTEMAPS]: Bitte Mapvorschlaege im Chat abgeben (z.B. ^"vote de_dust^"). Ihr habt noch %i Sekunden Zeit!",g_nominatetime);
say(Text);
g_vote_canceled=0;
set_timer("vote_warning",15,0);
}else{
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Eine Map-Nominierung bzw. Vote ist bereits im Gange!");
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
public vote_warning(Timer,Repeat,HLName,HLParam) {
new Text[MAX_TEXT_LENGTH];
if(!g_vote_canceled){
g_nominatetime-=g_setnominatewarntime;
if(g_nominatetime>0){
sound_all(g_VoteWarn);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Mapvorschlaege im Chat abgeben (z.B. ^"vote de_dust^"). Ihr habt noch %i Sekunden Zeit!",g_nominatetime);
say(Text);
set_timer("vote_warning",g_setnominatewarntime,0);
}else{
g_votestart=1;
sound_all(g_VoteNow);
show_vote("all",0);
set_timer("vote_calculate",g_setvotetime,0);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]:^nGebt Euren Vote ab!");
centersay(Text,12,255,255,255);
}
}else{
sound_all(g_VoteFailed);
say("[VFI-NOMINATE]: Vote wurde abgebrochen!");
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Naechste Map ist %s",g_NextMap);
say(Text);
reset_nominations();
}
}
public vote_calculate(Timer,Repeat,HLName,HLParam) {
calculate();
}
calculate(){
new Text[MAX_TEXT_LENGTH];
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]:^nVote abgeschlossen!");
centersay(Text,12,255,255,255);
if(!g_vote_canceled){
new UserName[MAX_NAME_LENGTH];
new MapVotes[10];
new maxplayers=maxplayercount();
new i;
new winmap;
new winvotes;
new votes;
new votecount;
/*Calculating votes*/
for(i=1;i<=maxplayers;i++){
if(playerinfo(i,UserName,MAX_NAME_LENGTH)){
if(g_UserSelect[i]!=0){
MapVotes[g_UserSelect[i]-1]+=1;
votecount++;
}
}
}
/*Find maxvotes and winning map*/
for(i=0;i<=g_suggestions;i++){
votes=max(MapVotes[i],winvotes);
if(votes>winvotes){
winvotes=MapVotes[i];
winmap=i;
}
}
if(winvotes!=0 && MapVotes[9]<winvotes){
sound_all(g_VotePassed);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: ^"%s^" hat mit %i von %i Stimmen gewonnen!",g_NominatedMaps[winmap],winvotes,votecount);
say(Text);
if(strcmp(g_NominatedMaps[winmap],g_CurrentMap)==0){
g_curextend++;
g_newtimelimit+=g_origtimelimit;
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: ^"%s^" wird um %i Minuten verlaengert!",g_NominatedMaps[winmap],g_origtimelimit);
say(Text);
snprintf(Text,MAX_TEXT_LENGTH, "mp_timelimit %i", g_newtimelimit);
exec(Text);
}else{
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Mapwechsel zu ^"%s^"!",g_NominatedMaps[winmap]);
say(Text);
changelevel(g_NominatedMaps[winmap],3);
}
}else{
sound_all(g_VoteFailed);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Leider hat keine Map eine Mehrheit erzielt! Vote fehlgeschlagen!");
say(Text);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Naechste Map ist %s",g_NextMap);
say(Text);
}
}else{
sound_all(g_VoteFailed);
say("[VFI-NOMINATE]: Vote wurde abgebrochen!");
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Naechste Map ist %s",g_NextMap);
say(Text);
}
reset_nominations();
}
show_vote(User[],UserIndex) {
new VoteDisplay[512];
new UserName[MAX_NAME_LENGTH];
new MapName[MAX_NAME_LENGTH];
new Text[512];
new i;
new x;
new keys=1;
new maxplayers=maxplayercount();
for(i=0;i<=g_suggestions;i++){
if(strlen(g_NominatedMaps[i])!=0){
x++;
if(x!=1){
keys+=keys;
}
if(strcasecmp(g_CurrentMap,g_NominatedMaps[i])==0){
strcpy(MapName,"EXTEND",MAX_NAME_LENGTH);
}else{
strcpy(MapName,g_NominatedMaps[i],MAX_NAME_LENGTH);
}
snprintf(Text,512,"%s^n%i.%s",Text,x,MapName);
if(x==8){
keys+=keys-1;
break;
}
}else{
keys+=keys-1;
break;
}
}
if(x!=0){
snprintf(VoteDisplay,512,"\yVOTE-MENU:^n\w%s",Text);
strcat(VoteDisplay,"^n^n\y0. keine davon",512);
keys=keys+512;
if(UserIndex!=0){
g_UserVoteMenu[UserIndex]=1;
menu(User,VoteDisplay,keys);
}else{
for(i=1;i<=maxplayers;i++){
if(playerinfo(i,UserName,MAX_NAME_LENGTH)){
g_UserVoteMenu[i]=1;
menu(UserName,VoteDisplay,keys);
}
}
}
}else{
centersay("[VFI-NOMINATE]:^nEs wurden keine^nMapvorschlaege gemacht!",12,255,255,255);
}
say("[VFI-NOMINATE]: Mit der Chateingabe ^"votemap^" kann man seinen Vote korrigieren!");
}
show_votechange(User[],UserIndex) {
new Text[512];
new UserVote[MAX_NAME_LENGTH];
if(g_UserSelect[UserIndex]==0){
snprintf(UserVote,MAX_NAME_LENGTH,"keine Map");
}else if(g_UserSelect[UserIndex]==10){
snprintf(UserVote,MAX_NAME_LENGTH,"Enthaltung");
}else{
snprintf(UserVote,MAX_NAME_LENGTH,"%s",g_NominatedMaps[g_UserSelect[UserIndex]-1]);
}
snprintf(Text,MAX_TEXT_LENGTH,"\y[VFI-NOMINATE]:^n^n\wDu hast zur Zeit fuer^n\y%s^n\wabgestimmt. Willst Du den:^n^n1. Vote aendern^n0. Nein. Ist OK",UserVote);
g_UserVoteMenu[UserIndex]=2;
menu(User,Text,513);
}
public menuselect(HLCommand,HLData,HLUserName,UserIndex){
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
new User[MAX_NAME_LENGTH];
new iSelect;
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGTH);
if(g_UserVoteMenu[UserIndex]!=0){
iSelect=strtonum(Data);
if(g_UserVoteMenu[UserIndex]==1){
if (iSelect==10){
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: %s hat sich enthalten!",User);
}else{
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: %s hat fuer %s abgestimmt!",User,g_NominatedMaps[iSelect-1]);
}
g_UserSelect[UserIndex]=iSelect;
say(Text);
return PLUGIN_HANDLED;
}else if(g_UserVoteMenu[UserIndex]==2){
if(iSelect==1){
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: %s aendert vielleicht sein Meinung!",User);
say(Text);
show_vote(User,UserIndex);
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public SetMenuData(HLCommand,HLData,HLUserName,UserIndex){
new UserName[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
if(g_UserVoteMenu[UserIndex]!=0){
reset_array(UserIndex);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Menue wurde durch ein anderes Menue beendet! Benutze ^"votemap^" im Chat, um es nochmal aufzurufen!");
messageex(UserName,Text,print_chat);
}
return PLUGIN_CONTINUE;
}
reset_array(UserIndex){
g_UserVoteMenu[UserIndex]=0;
}
reset_nominations(){
new i;
new maxplayers=maxplayercount();
for(i=0;i<=g_suggestions;i++){
strinit(g_NominatedMaps[i]);
}
for(i=1;i<=maxplayers;i++){
g_UserVoteMenu[i]=0;
g_UserSelect[i]=0;
}
g_suggestions=0;
g_nominatetime=0;
g_vote_canceled=0;
g_votestart=0;
}
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
new UserName[MAX_NAME_LENGTH];
new Map[MAX_NAME_LENGTH];
new i;
new x;
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
strstripquotes(Data);
if(strcmp(Data,"votemap")==0){
if(g_votestart){
show_votechange(UserName,UserIndex);
}else{
messageex(UserName,"[VFI-NOMINATE]: Vote hat noch nicht stattgefunden oder ist bereits abgeschlossen!",print_chat);
return PLUGIN_HANDLED;
}
}else if(strstr(Data,"vote")==0){
if(g_votestart==0){
strbreak(Data,Data,Map,MAX_NAME_LENGTH);
if(g_suggestions<8){
if(strcmp(Map,"extend")==0){
strcpy(Map,g_CurrentMap,MAX_NAME_LENGTH);
}
if(valid_map(Map)){
/*Nächste Map nach Mapcycle von der Nominierung ausschliessen*/
if(strcasecmp(g_NextMap,Map)==0){
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Naechste Map ist %s und braucht daher nicht nominiert zu werden!",g_NextMap);
say(Text);
return PLUGIN_HANDLED;
}
/*Überprüfung, ob die Map bereits vorgeschlagen wurde*/
for(i=0;i<=g_suggestions;i++){
if(strcasecmp(Map,g_NominatedMaps[i])==0){
messageex(UserName,"[VFI-NOMINATE]: Fuer die Map wurde bereits eine Nominierung abgegeben!",print_chat);
return PLUGIN_HANDLED;
}
}
/*Überprüfung , ob ein EXTEND zulässig ist*/
if(strcasecmp(Map,g_CurrentMap)==0){
if(g_curextend<g_maxextend){
strcpy(g_NominatedMaps[g_suggestions],Map,MAX_NAME_LENGTH);
g_suggestions++;
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: %s hat eine Verlaengerung der Map vorgeschlagen!",UserName);
say(Text);
return PLUGIN_HANDLED;
}else{
messageex(UserName,"[VFI-NOMINATE]: Map kann nicht nochmal verlaengert werden!",print_chat);
return PLUGIN_HANDLED;
}
}else{
/*Überprüfung, ob die Map nicht schon zuvor gelaufen ist*/
for(i=0;i<=5;i++){
if(strcasecmp(g_LastMaps[i],Map)==0){
x=1;
break;
}
}
if(!x){
strcpy(g_NominatedMaps[g_suggestions],Map,MAX_NAME_LENGTH);
g_suggestions++;
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: %s hat als Mapwechsel %s vorgeschlagen!",UserName,Map);
say(Text);
return PLUGIN_HANDLED;
}else{
messageex(UserName,"[VFI-NOMINATE]: Map lief bereits und kann vorerst nicht nochmal vorgeschlagen werden!",print_chat);
snprintf(Text,MAX_TEXT_LENGTH,"[VFI-NOMINATE]: Ausgeschlossene Maps sind: %s %s %s %s %s",g_LastMaps[0],g_LastMaps[1],g_LastMaps[2],g_LastMaps[3],g_LastMaps[4]);
say(Text);
return PLUGIN_HANDLED;
}
}
}else{
messageex(UserName,"[VFI-NOMINATE]: Die Map ist leider nicht gueltig!",print_chat);
return PLUGIN_HANDLED;
}
}else{
messageex(UserName,"[VFI-NOMINATE]: Maximale Anzahl von 8 Mapvorschlaegen wurde erreicht!",print_chat);
return PLUGIN_HANDLED;
}
}else{
messageex(UserName,"[VFI-NOMINATE]: Ein Vote ist bereits im Gange! Es koennen keine Vorschlaege mehr angenommen werden!",print_chat);
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;