hast du vielleicht sowas hier vor?
Code:
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.50";
new iTimer[MAX_PLAYERS] = {0,0,...};
new Slaps[MAX_PLAYERS] = {0,0,...};
public admin_mslap(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new Text[MAX_TEXT_LENGTH];
new sSlaps[MAX_NUMBER_LENGTH];
new sIndex[MAX_NUMBER_LENGTH];
new iIndex,iDead;
new iSlaps;
convert_string(HLData,Data,MAX_DATA_LENGTH);
strstripquotes(Data);
strbreak(Data,Data,sSlaps,MAX_DATA_LENGTH);
if (check_user(Data) == 0) {
selfmessage("Unrecognized player:");
selfmessage(Data);
} else {
get_username(Data,Data,MAX_NAME_LENGTH);
if(check_immunity(Data) == 1) {
snprintf(Text,MAX_TEXT_LENGTH,"Laf. You can't slap %s, you silly bear.",Data);
selfmessage(Text);
} else {
get_userindex(Data,iIndex);
if(iTimer[iIndex] != 0) {
selfmessage("That player is being slapped at the moment");
} else {
if(playerinfo(iIndex,Data,MAX_NAME_LENGTH,_,_,_,iDead) == 0) {
selfmessage("Error: Could not find player any more.");
} else {
if(iDead == 1) {
snprintf(Text,MAX_TEXT_LENGTH,"You cannot slap %s, player is dead.",Data);
selfmessage(Text);
} else {
if(strlen(sSlaps) == 0 || strtonum(sSlaps) < 0) {
selfmessage("Number of slaps missing, using default (3)");
iSlaps = 2;
Slaps[iIndex] = iSlaps +1;
} else if(streq(sSlaps,"0") == 1) {
selfmessage("Slapping target to death.");
iSlaps = 99999;
Slaps[iIndex] = 0;
} else {
iSlaps = strtonum(sSlaps) - 1;
}
slap(Data);
numtostr(iIndex,sIndex);
if(iSlaps > 0) {
iTimer[iIndex] = set_timer("TimerSlap",1,iSlaps,sIndex);
}
}
}
}
}
}
return PLUGIN_HANDLED;
}
public TimerSlap(Timer,Repeat,HLUser,HLParam) {
new sIndex[MAX_NUMBER_LENGTH];
new Admin[MAX_NAME_LENGTH],Victim[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
new iIndex;
new iDead;
convert_string(HLUser,Admin,MAX_NAME_LENGTH);
convert_string(HLParam,sIndex,MAX_NUMBER_LENGTH);
iIndex = strtonum(sIndex);
if(playerinfo(iIndex,Victim,MAX_NAME_LENGTH,_,_,_,iDead) == 1) {
if (iDead == 0) {
slap(Victim);
if(Repeat == 1) {
snprintf(Text,MAX_TEXT_LENGTH,"Successfully slapped %s %i times.",Victim,Slaps[iIndex]);
messageex(Admin,Text,print_chat);
kill_timer(iTimer[iIndex]);
iTimer[iIndex] = 0;
}
} else {
snprintf(Text,MAX_TEXT_LENGTH,"Cannot slap %s anymore, player has died.",Victim);
messageex(Admin,Text,print_chat);
if(Slaps[iIndex] == 0) {
snprintf(Text,MAX_TEXT_LENGTH,"Successfully slapped %s %i times",Victim,100000-Repeat);
} else {
snprintf(Text,MAX_TEXT_LENGTH,"Canceled slapping %s after %i Slaps, %i remaining.",Victim,Slaps[iIndex]-Repeat,Repeat);
}
messageex(Admin,Text,print_chat);
kill_timer(iTimer[iIndex]);
iTimer[iIndex] = 0;
}
} else {
snprintf(Text,MAX_TEXT_LENGTH,"Error: Could not find player %s any more.",Victim);
messageex(Admin,Text,print_chat);
kill_timer(iTimer[iIndex]);
iTimer[iIndex] = 0;
}
}
public plugin_init() {
plugin_registerinfo("Rinde's multislap plugin","Slaps people multiple times.",STRING_VERSION);
plugin_registercmd("admin_mslap","admin_mslap",ACCESS_KICK,"admin_mslap <#>: Slaps <#> times, 0 slaps until player is dead.");
return PLUGIN_CONTINUE;
}