Junior Member
|
09-04-2004
, 14:57
|
#3
|
mhh it doesnt work it says "you do not have access to this command". besides i dont like the amxx vote plugin anyway because in most cases it doesnt change the map even if the vote was successful and although "yes" for accepting the result was pressed, it says "result refused"..
is there a way to transfer this to amxx ?
Quote:
/* admin_vote_map <map> */
public admin_vote_map(HLCommand,HLData,HLUserName,Us erIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
new User[MAX_NAME_LENGTH];
if (vote_allowed()!=1) {
selfmessage( "Vote not allowed at this time.");
return PLUGIN_HANDLED;
}
convert_string(HLCommand,Command,MAX_COMMAND_ LENGTH);
convert_string(HLData,Data,MAX_DATA_LENGTH);
convert_string(HLUserName,User,MAX_NAME_LENGT H);
if (valid_map(Data) == 1) {
snprintf(Text, MAX_TEXT_LENGTH, "Change map to %s?", Data);
log(Text);
if (vote(Text,"Yes","No","HandleMapVote",Data)) {
g_VoteInProgress = 1;
g_AbortVote=0;
}
} else {
snprintf(Text, MAX_TEXT_LENGTH, "You cannot vote for map %s on this server",Data);
selfmessage(Text);
}
return PLUGIN_HANDLED;
}
/* Handle a map vote's results. */
public HandleMapVote(WinningOption,HLMap,VoteCount,U serCount) {
new strNumber[MAX_NUMBER_LENGTH];
new Text[MAX_TEXT_LENGTH];
new VoteMap[MAX_DATA_LENGTH];
convert_string(HLMap,VoteMap,MAX_DATA_LENGTH) ;
g_VoteInProgress = 0;
if (WinningOption == 1) {
new Ratio = getvar("map_ratio");
if (VoteCount >= Ratio*UserCount/100) {
if (g_AbortVote) {
say("Map vote was aborted by an admin");
} else {
set_timer("VoteChangeMap",10,1,VoteMap);
}
} else {
numtostr(Ratio*UserCount/100,strNumber);
snprintf(Text, MAX_TEXT_LENGTH, "Map vote succeeded, but not enough votes for change (needed %s)", strNumber);
say(Text);
}
} else {
say("Map vote failed.");
}
}
/* Actually kick the user, unless aborted. */
public VoteChangeMap(Timer,Repeat,HLUserName,HLParam ) {
new Text[MAX_TEXT_LENGTH];
new VoteMap[MAX_DATA_LENGTH];
convert_string(HLParam,VoteMap,MAX_DATA_LENGT H);
if (g_AbortVote) {
say("Map vote aborted by an admin");
}
else {
snprintf(Text, MAX_TEXT_LENGTH, "Changing map to %s due to vote.", VoteMap);
say(Text);
changelevel(VoteMap, 4);
}
}
|
that would be nice if someone could add this command to amxx for me
|
|