/* cavey.inc Latest version at http://www.scriptordie.com/ I made this - Caveman ( ICQ 70710878 ) */ #if defined _cavey_included #endinput #endif #define _cavey_included 9 #include <plugin> new _CS = -1; new cavey_isinit=0; new cavey_timer=0; new cavey_timers[MAX_PLAYERS]={0,0,...}; new cavey_flicker_state=0; new cavey_colours[7]={0,0,...}; new cavey_scrollvars[3]={0,0,...}; /*0 is type, 1 is scroll length, 2 is scrollspeed*/ new GLOW_TIME=30; #if !defined MAX_SHORT_LENGTH #define MAX_SHORT_LENGTH 30 #endif stock cavey_init(){ cavey_isinit=1; cavey_timer=0; cavey_flicker_state=0; cavey_vault_init("CAVEY_GLOW_TIME", 120, GLOW_TIME); _CS = get_mod("Counter-Strike"); } stock bury(Data[]) { new Text[MAX_TEXT_LENGTH]; if (check_user(Data) == 1) { new nIndex, nDead; new TargetName[MAX_NAME_LENGTH]; get_userindex(Data, nIndex); playerinfo(nIndex, TargetName, MAX_NAME_LENGTH, _, _, _, nDead); if (cavey_isinit==0){ cavey_init(); } if (nDead == 0) { new x, y, z; get_userorigin(TargetName, x, y, z); if (_CS){ execclient(TargetName, "slot1"); // drop his first weapon execclient(TargetName, "+attack"); execclient(TargetName, "-attack"); execclient(TargetName, "drop"); execclient(TargetName, "slot2"); // drop his pistol (if any) execclient(TargetName, "+attack"); execclient(TargetName, "-attack"); execclient(TargetName, "drop"); execclient(TargetName, "slot5"); // drop the bomb (if any) execclient(TargetName, "+attack"); execclient(TargetName, "-attack"); execclient(TargetName, "drop"); teleport(TargetName, x, y, (z-20)); } else { teleport(TargetName, x, y, (z-50)); } if (getvar("admin_fx") == 1){ playsound(TargetName, "ambience/xtal_down1.wav"); } } else { snprintf(Text, MAX_TEXT_LENGTH, "%s is dead. You can't bury them!", TargetName); selfmessage(Text); } } else { snprintf(Text, MAX_TEXT_LENGTH, "Unrecognized player: %s", Data); selfmessage(Text); } } stock unbury(Data[]) { new Text[MAX_TEXT_LENGTH]; if (check_user(Data) == 1) { new nIndex, nDead; new TargetName[MAX_NAME_LENGTH]; get_userindex(Data, nIndex); playerinfo(nIndex, TargetName, MAX_NAME_LENGTH, _, _, _, nDead); if (nDead == 0) { new x, y, z; get_userorigin(TargetName, x, y, z); teleport(TargetName, x, y, (z+50)); } else { snprintf(Text, MAX_TEXT_LENGTH, "%s is dead. You can't bury them!", TargetName); selfmessage(Text); } } else { snprintf(Text, MAX_TEXT_LENGTH, "Unrecognized player: %s", Data); selfmessage(Text); } } stock plrinfo( iPlayerIndex, sName[], iLength, &iUserID, sAuthID[MAX_AUTHID_LENGTH], &iTeam, &iDead){ if ( (iPlayerIndex <= maxplayercount()) && (iPlayerIndex >=1) ){ new Dummy; return playerinfo(iPlayerIndex, sName, iLength, iUserID, Dummy, iTeam, iDead, sAuthID); } return 0; } stock split(sSource[], sToken[], sData1[], iLen1, sData2[], iLen2){ new start = strcasestr(sSource,sToken); strncpy(sData1,sSource,start,iLen1); new j=0; for (new i=(start+strlen(sToken));((i<=strlen(sSource)) && (j<iLen2));i++){ sData2[j++]=sSource[i]; } sData2[j+1] = 0; } stock strrep(sString[],sToken[],sWith[],iMaxLen){ new i=0; new First[MAX_DATA_LENGTH], Second[MAX_DATA_LENGTH]; for (i=0;strcasestr(sString,sToken)!=-1;i++){ split(sString ,sToken ,First, MAX_DATA_LENGTH, Second, MAX_DATA_LENGTH); snprintf(sString,iMaxLen,"%s%s%s",First,sWith,Second); } return i; } /*The following gets and store settings in the vault on init. First does it as an int second does it as a string. It basically makes sure the vault key is set.*/ stock cavey_vault_init(sKey[], iDefault, &iValue){ new cmnTemp[MAX_TEXT_LENGTH]; strinit(cmnTemp); get_vaultdata(sKey, cmnTemp, MAX_TEXT_LENGTH); if (strlen(cmnTemp) != 0){ iValue = strtonum(cmnTemp); } else { iValue = iDefault; } snprintf(cmnTemp,MAX_TEXT_LENGTH,"%d",iValue); set_vaultdata(sKey,cmnTemp); } stock cavey_vault_sinit(sKey[], sDefault[], sValue[], iMaxLen){ new cmnTemp[MAX_TEXT_LENGTH]; strinit(cmnTemp); get_vaultdata(sKey, cmnTemp, MAX_TEXT_LENGTH); if (strlen(cmnTemp) != 0){ strcpy(sValue,cmnTemp,iMaxLen); } else { strcpy(sValue,sDefault,iMaxLen); } snprintf(cmnTemp,MAX_TEXT_LENGTH,"%s",sValue); set_vaultdata(sKey,cmnTemp); } /*These work in the same style as the standard file functions BUT they automatically adjust the place to includ the CAVEY_PATH*/ new cavey_path[MAX_TEXT_LENGTH]; stock cavey_writefile(sFileName[],sText[],iLineNum=-1){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); return writefile(sFile,sText,iLineNum); } stock cavey_readfile(sFileName[],sText[],iLine,iMaxLen){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); return readfile(sFile,sText,iLine,iMaxLen); } stock cavey_filesize(sFileName[],bylines = 1){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); return filesize(sFile,bylines); } stock cavey_resetfile(sFileName[]){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); if (fileexists(sFile)){ return resetfile(sFile); } return 0; } stock cavey_deletefile(sFileName[]){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); if (fileexists(sFile)){ return deletefile(sFile); } return 0; } stock cavey_fileexists(sFileName[]){ new sFile[MAX_TEXT_LENGTH]; snprintf(sFile,MAX_TEXT_LENGTH,"%s%s",cavey_path,sFileName); return fileexists(sFile); } /*Something to force a different error. Ignore it*/ stock Update_Your_Cavey_Inc(sName[]){ say(sName); } /*Use.... cavey_vault_init("LOGD_INSTALLED", logd_detect(), logd)*/ stock logd_detect(){ new i = getvar("logd_debug"); exec("logd_debug 1"); if (getvar("logd_debug") == 1){ new cmnTemp[MAX_NAME_LENGTH]; snprintf(cmnTemp,MAX_NAME_LENGTH,"logd_debug %d",i); exec(cmnTemp); return 1; } else { return 0; } return 0; } /*Gets a mod from the liblist.gam*/ stock get_mod(sMod[]){ new GameDir[MAX_DATA_LENGTH]; new Data[MAX_DATA_LENGTH]; /*See if it has been found on a previous attempt or if the admin has set it*/ strinit(GameDir); get_vaultdata("MOD",GameDir,MAX_DATA_LENGTH); if (strlen(GameDir)<=0){ /*Not set therefore find it from the liblist.gam*/ for (new i=1; (strncasecmp(Data,"Game",4)!=0) && readfile("liblist.gam",Data,i,MAX_DATA_LENGTH);i++){ } say(Data); if (strncasecmp(Data,"Game",4)==0){ /*We found it, therefore set it so we dont have to look again*/ strgsplit(Data," ","^"",Data,MAX_DATA_LENGTH,GameDir,MAX_DATA_LENGTH); set_vaultdata("MOD",GameDir); } else { /*Its unkown, but lets not bother looking again, let the admin sort it out*/ set_vaultdata("MOD","Unknown"); } } /*Anyway, does it match?*/ if(streq(GameDir,sMod)){ return 1; } return 0; } /*Removes non-standard characters*/ stock make_safe(Unsafe[]){ for (new i=0;i<strlen(Unsafe);i++){ if ( !( ( (Unsafe[i]>='0') && (Unsafe[i]<='9') ) || ( (Unsafe[i]>=' ') && (Unsafe[i]<='Z') ) || ( (Unsafe[i]>='a') && (Unsafe[i]<='z') ) ) ){ Unsafe[i] = ' '; /*Replace any non-safe characters with a ' '*/ } } return; } /*Designed to do all the sorting. You give it a Type and it executes it on the user.*/ stock punnish(UserIndex,PunnishType[],Reason[]="",public_punnish=-1,IgnoreImmunity=0,A_DisplayType[]="csay",A_Colour[]="red",A_Colour2[]="blue",iTime=10,ReWrite=-1){ new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; new Data[MAX_DATA_LENGTH]; if (cavey_isinit==0){ cavey_init(); } if (public_punnish <= -1){ cavey_vault_init("CAVEY_PUNNISH_PUBLIC", 1, public_punnish); } if (plrinfo(UserIndex,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ if (streq(PunnishType,"none")){ return; } else if (streq(PunnishType,"slap") && (check_immunity(User)==0 || IgnoreImmunity>=1)){ if ( iDead == 0 ){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been slapped^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been slapped",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } cavey_punnishlog("slapped",UserIndex,Reason); slap(User); } else { snprintf(Data,MAX_DATA_LENGTH,"Unable to slap %s - user is dead",User); selfmessage(Data); } } else if (strcasestr(PunnishType,"mslap") != -1 && (check_immunity(User)==0 || IgnoreImmunity>=1)){ if ( iDead == 0 ){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been slapped^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been slapped",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } new sTimes[MAX_DATA_LENGTH]; strbreak(PunnishType,Data,sTimes,MAX_DATA_LENGTH); new Slap_Times = strtonum(sTimes); cavey_punnishlog("slapped",UserIndex,Reason); for (new i=0;i<Slap_Times;i++){ slap(User); } } else { snprintf(Data,MAX_DATA_LENGTH,"Unable to slap %s - user is dead",User); selfmessage(Data); } } else if (strcasestr(PunnishType,"glow") != -1 && (check_immunity(User)==0 || IgnoreImmunity>=1)){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s is glowing^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s is glowing",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } new sTimes[MAX_DATA_LENGTH],R,G,B; strbreak(PunnishType,Data,sTimes,MAX_DATA_LENGTH); get_colour(sTimes,R,G,B); cavey_punnishlog("glowing",UserIndex,Reason); glow(User,R,G,B); if (cavey_timers[UserIndex] != 0){ kill_timer(cavey_timers[UserIndex]); cavey_timers[UserIndex] = 0; } snprintf(Data,MAX_DATA_LENGTH,"%d",UserIndex); cavey_timers[UserIndex] = set_timer("killglow_timer",GLOW_TIME,0,Data); } else if (streq(PunnishType,"bury") && (check_immunity(User)==0 || IgnoreImmunity>=1)){ if ( iDead == 0 ){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been buried^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been buried",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } cavey_punnishlog("buried",UserIndex,Reason); bury(User); } else { snprintf(Data,MAX_DATA_LENGTH,"Unable to bury %s - user is dead",User); selfmessage(Data); } } else if (streq(PunnishType,"slay") && (check_immunity(User)==0 || IgnoreImmunity>=1)){ if ( iDead == 0 ){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been slain^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been slain",User,Reason); } centersay(Data,10,255,10,10); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } else { snprintf(Data,MAX_DATA_LENGTH,"Unable to slay %s - user is dead",User); selfmessage(Data); } cavey_punnishlog("slain",UserIndex,Reason); slay(User); } else if (streq(PunnishType,"chicken") && (check_immunity(User)==0 || IgnoreImmunity>=2)){ getstrvar("chicken_version",Data,MAX_DATA_LENGTH); if (strlen(Data)>0){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been turned into a Chicken^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been turned into a Chicken",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } snprintf(Data, MAX_TEXT_LENGTH, "c_chicken # %i", UserIndex); cavey_punnishlog("chickend",UserIndex,Reason); exec(Data); } else { log("[CAVEY]Chickenmod is not installed. Cannot create a chicken"); } } else if (streq(PunnishType,"kick") && (check_immunity(User)==0 || IgnoreImmunity>=2)){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been kicked^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been kicked",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } if(strlen(Reason)>0){ snprintf(Data,MAX_DATA_LENGTH,"You have been kicked from the server for %s",Reason); } else { snprintf(Data,MAX_DATA_LENGTH,"You have been kicked from the server",User,Reason); } messageex(User,Data,print_chat); messageex(User,Data,print_console); cavey_punnishlog("kicked",UserIndex,Reason); kick(User); } else if ( (streq(PunnishType,"permban") || streq(PunnishType,"perm ban") || streq(PunnishType,"ban 0") ) && (check_immunity(User)==0)){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been permanantly banned^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been permanantly banned",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } if(strlen(Reason)>0){ snprintf(Data,MAX_DATA_LENGTH,"You have been permanantly banned from the server for %s",Reason); } else { snprintf(Data,MAX_DATA_LENGTH,"You have been permanantly banned from the server"); } messageex(User,Data,print_chat); messageex(User,Data,print_console); cavey_punnishlog("banned",UserIndex,Reason); ban(User,0,getvar("sv_lan")); } else if ( (streq(PunnishType,"ban") ) && (check_immunity(User)==0 || IgnoreImmunity>=3)){ if (public_punnish){ if(strlen(Reason)>0 && ReWrite != 0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been banned^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been banned",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } if(strlen(Reason)>0){ snprintf(Data,MAX_DATA_LENGTH,"You have been banned from the server for %s",Reason); } else { snprintf(Data,MAX_DATA_LENGTH,"You have been banned from the server"); } messageex(User,Data,print_chat); messageex(User,Data,print_console); cavey_punnishlog("tempbanned",UserIndex,Reason); ban(User,60,getvar("sv_lan")); } else if ( (streq(PunnishType,"warn") ) && ( check_immunity(User)==0 || IgnoreImmunity>=1 )){ new Anint; if ( plugin_checkcommand("admin_warn",Anint) > 0 ){ cavey_warn(UserIndex,Reason); } else { cavey_elevated_warn(UserIndex,Reason); } } else if ( (streq(PunnishType,"none") || streq(PunnishType," ") ) ){ if (public_punnish){ if(strlen(Reason)>0){ snprintf(Data,MAX_DATA_LENGTH,"%s has been warned^n^nfor^n^n%s",User,Reason); } else if(strlen(Reason)>0 && ReWrite == 0){ strcpy(Data,Reason,MAX_DATA_LENGTH); } else { snprintf(Data,MAX_DATA_LENGTH,"%s has been warned",User,Reason); } cavey_display(A_DisplayType,Data,A_Colour,A_Colour2,iTime,UserIndex); } } else { snprintf(Data,MAX_DATA_LENGTH,"[CAVEY] Unable to find punnishment %s",PunnishType); selfmessage(Data); log(Data); } } else { snprintf(Data,MAX_DATA_LENGTH,"[CAVEY] Unable to find player %d",UserIndex); selfmessage(Data); log(Data); } return; } stock cavey_punnishlog(Type[],UserIndex,Reason[]){ new Filename[MAX_DATA_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; if (plrinfo(UserIndex,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ snprintf(Filename,MAX_DATA_LENGTH,"%s.log",Type); if (getvar("sv_lan")== 1){ get_userIP(User,Text,MAX_TEXT_LENGTH); snprintf(Data,MAX_DATA_LENGTH,"^t%s^t%s^t%s",User, Text,Reason); } else { snprintf(Data,MAX_DATA_LENGTH,"^t%s^t%s^t%s",User, sAuthID,Reason); } servertime(Text, MAX_TEXT_LENGTH, "%B/%d/%Y %H:%M"); strcat(Text,Data,MAX_DATA_LENGTH); cavey_writefile(Filename,Text,-1); } return; } public killglow_timer(Timer,Repeat,HLUserName,HLParam){ new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; new Data[MAX_DATA_LENGTH]; convert_string(HLParam,Data,MAX_DATA_LENGTH); new UserIndex = strtonum(Data); if (cavey_timers[UserIndex]!=0){ cavey_timers[UserIndex]=0; } if (plrinfo(UserIndex,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ glow(User,0,0,0); } return PLUGIN_HANDLED; } /*This should be used for times when the user calls it from a menuselect or from a "weapon_" call*/ stock cavey_self_warn(UserIndex,Reason[]){ new Command[MAX_COMMAND_LENGTH], Anint; get_vaultdata("CAVEY_WARN_CMD",Command,MAX_COMMAND_LENGTH); if (plugin_checkcommand(Command,Anint)){ plugin_exec(Command,Reason); } else { selfmessage("[CAVEY] Unable to perform a warning - No warn plugin installed"); log("[CAVEY] Unable to perform a warning - No warn plugin installed"); } } /*This should be used for times when the user does not have access to the command, for example from a TKRevenge plugin*/ stock cavey_elevated_warn(UserIndex,Reason[]){ new Command[MAX_COMMAND_LENGTH], Anint; new Data[MAX_DATA_LENGTH]; get_vaultdata("CAVEY_EWARN_CMD",Command,MAX_COMMAND_LENGTH); snprintf(Data, MAX_DATA_LENGTH,"^"%d^" ^"%s^"",UserIndex,Reason); if (plugin_checkcommand(Command,Anint)){ plugin_exec(Command,Data); } else { selfmessage("[CAVEY] Unable to perform a warning - No warn plugin installed"); log("[CAVEY] Unable to perform a warning - No warn plugin installed"); } } /*This should be called from plugin_connect or from a command such as admin_vote_warn or if you want to tag it onto a "admin_kick" command*/ stock cavey_warn(UserIndex,Reason[]){ new Data[MAX_DATA_LENGTH], Anint; snprintf(Data, MAX_DATA_LENGTH,"^"%d^" ^"%s^"",UserIndex,Reason); if (plugin_checkcommand("admin_warn",Anint)){ plugin_exec("admin_warn",Data); } else { selfmessage("[CAVEY] Unable to perform a warning - No warn plugin installed"); log("[CAVEY] Unable to perform a warning - No warn plugin installed"); } } stock cavey_display(sDisplay_type[],sText[],sColour1[]="",sColour2[]="",iTime=10,UserIndex=0){ new iRed[2], iGreen[2], iBlue[2]; new Colour[MAX_SHORT_LENGTH]; if (streq(sDisplay_type,"none") ){ return; } /*Sort out the colours*/ for (new i=0;i<2;i++){ if (i==0 && strlen(sColour1)>0){ strcpy(Colour,sColour1,MAX_COMMAND_LENGTH); } else if (i==1 && strlen(sColour2)>0){ strcpy(Colour,sColour2,MAX_COMMAND_LENGTH); } else if (i==0){ /**/ iRed[i] = 250; iGreen[i] = 10; iBlue[i] = 10; continue; } else { iRed[i] = 10; iGreen[i] = 10; iBlue[i] = 10; continue; } get_colour(Colour,iRed[i], iGreen[i], iBlue[i]); } if (streq(sDisplay_type,"ptsay") || streq(sDisplay_type,"privatetypesay")|| streq(sDisplay_type,"privatetsay")){ new User[MAX_NAME_LENGTH],iSessionID,iTeam,iDead,sAuthID[MAX_AUTHID_LENGTH]; if (plrinfo(UserIndex, User, MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ messageex(User,sText,print_tty); } } else if (streq(sDisplay_type,"pcsay") || streq(sDisplay_type,"privatecentresay")|| streq(sDisplay_type,"privatecsay")){ new User[MAX_NAME_LENGTH],iSessionID,iTeam,iDead,sAuthID[MAX_AUTHID_LENGTH]; if (plrinfo(UserIndex, User, MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ messageex(User,sText,print_pretty); } } else if (streq(sDisplay_type,"tsay") || streq(sDisplay_type,"typesay")){ typesay(sText,iTime,iRed[0],iGreen[0],iBlue[0]); } else if (streq(sDisplay_type,"rsay") || streq(sDisplay_type,"rainbowsay") || streq(sDisplay_type,"rainbow")){ rainbow(sText,iTime,iRed[0],iGreen[0],iBlue[0],iRed[1],iGreen[1],iBlue[1]); } else if (streq(sDisplay_type,"say") || streq(sDisplay_type,"print_chat")) { say(sText); } else if (streq(sDisplay_type,"fsay") || streq(sDisplay_type,"flickersay")) { flickersay(sText,iTime,iRed[0],iGreen[0],iBlue[0],iRed[1],iGreen[1],iBlue[1]); } else if (streq(sDisplay_type,"hlgsay") || streq(sDisplay_type,"csgsay")) { hlgsay(sText,iTime); } else if (streq(sDisplay_type,"scsay") || streq(sDisplay_type,"scrollcsay")) { scrollsay(sText,iRed[0],iGreen[0],iBlue[0],iRed[1],iGreen[1],iBlue[1],0); } else if (streq(sDisplay_type,"stsay") || streq(sDisplay_type,"scrolltsay")) { scrollsay(sText,iRed[0],iGreen[0],iBlue[0],iRed[1],iGreen[1],iBlue[1],1); } else if (streq(sDisplay_type,"srsay") || streq(sDisplay_type,"scrolrsay")) { scrollsay(sText,iRed[0],iGreen[0],iBlue[0],iRed[1],iGreen[1],iBlue[1],2); } else { centersay(sText,iTime,iRed[0],iGreen[0],iBlue[0]); } return; } /*Checks Colour and returns the RGB values. Returns RED if the colour is unknown or left blank. Also takes a colour as "102 132 36" for RGB colours.*/ stock get_colour(Colour[],&iRed,&iGreen,&iBlue){ if (streq(Colour, "red") || strlen(Colour)==0){ iRed = 255; iGreen = 10; iBlue = 10; } else if (streq(Colour, "green")) { iRed = 10; iGreen = 255; iBlue = 10; } else if (streq(Colour, "blue")) { iRed = 10; iGreen = 10; iBlue = 255; } else if ( (streq(Colour, "cyan")) || (streq(Colour, "teal")) || (streq(Colour, "agua")) ) { iRed = 10; iGreen = 255; iBlue = 255; } else if ( (streq(Colour, "lime")) ) { iRed = 10; iGreen = 10; iBlue = 250; } else if (streq(Colour, "skyblue")) { iRed = 0; iGreen = 0; iBlue = 255; } else if (streq(Colour, "darkblue")) { iRed = 24; iGreen = 0; iBlue = 76; } else if (streq(Colour, "magenta")) { iRed = 255; iGreen = 10; iBlue = 255; } else if (streq(Colour, "yellow")) { iRed = 255; iGreen = 255; iBlue = 10; } else if (streq(Colour, "gold")) { iRed = 255; iGreen = 204; iBlue = 10; } else if (streq(Colour, "pink")) { iRed = 252; iGreen = 60; iBlue = 200; } else if (streq(Colour, "orange")) { iRed = 255; iGreen = 100; iBlue = 10; } else if (streq(Colour, "purple")) { iRed = 250; iGreen = 10; iBlue = 250; } else if (streq(Colour, "turquoise")) { iRed = 63; iGreen = 187; iBlue = 239; } else if (streq(Colour, "brown")) { iRed = 139; iGreen = 59; iBlue = 19; } else if (streq(Colour, "navy")) { iRed = 24; iGreen = 0; iBlue = 76; } else if (streq(Colour, "white")) { iRed = 255; iGreen = 255; iBlue = 255; } else if (streq(Colour, "random")) { iRed = random(255); iGreen = random(255); iBlue = random(255); } else if (streq(Colour, "none") || streq(Colour, "off") || streq(Colour, "black")) { iRed = 0; iGreen = 0; iBlue = 0; } else { new pWord[MAX_SHORT_LENGTH]; new pWord1[MAX_SHORT_LENGTH]; new pWord2[MAX_SHORT_LENGTH]; strgsplit(Colour, " ", "^"", pWord, MAX_SHORT_LENGTH, pWord1, MAX_SHORT_LENGTH, pWord2, MAX_SHORT_LENGTH); iRed = strtonum(pWord); iGreen = strtonum(pWord1); iBlue = strtonum(pWord2); if ( (iRed == 0 || iGreen == 0 || iBlue == 0) ){ iRed = 250; iGreen = 10; iBlue = 10; return 0; } } return 1; } /* iFilter = 0 All iFilter = 1 If on Team iValue iFilter = 2 If access to iValue iFilter = 2 If iDead matches iValue */ stock messageex_all(sData[],iType,iValue=0,iFilter=0){ for (new i=1;i<maxplayercount();i++){ new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; if (plrinfo(i,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ if(iFilter==1){ if (iValue == iTeam){ messageex(User,sData,iType); } } else if(iFilter==2){ if (access(iValue,User)){ messageex(User,sData,iType); } } else if(iFilter==3){ if (iValue == iDead){ messageex(User,sData,iType); } } else { messageex(User,sData,iType); } } } return; } stock play_sound_to_all(sSound[],ForceSound=0,iValue=0,iFilter=0){ if (getvar("admin_fx")==1 || ForceSound > 0){ new UserInfo[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; for (new i=1;i<maxplayercount();i++){ if (plrinfo(i,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ if(iFilter==1){ if (iValue == iTeam){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ playsound(User, sSound); } } } else if(iFilter==2){ if (access(iValue,User)){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ playsound(User, sSound); } } } else if(iFilter==3){ if (iValue == iDead){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ playsound(User, sSound); } } } else { get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ playsound(User, sSound); } } } } } return; } stock speak_to_all(sSound[],ForceSound=0,iValue=0,iFilter=0){ if (getvar("admin_fx")==1 || ForceSound > 0){ new UserInfo[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH],iSessionID,sAuthID[MAX_AUTHID_LENGTH],iTeam,iDead; for (new i=1;i<maxplayercount();i++){ if (plrinfo(i,User,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)){ if(iFilter==1){ if (iValue == iTeam){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ speakto(User, sSound); } } } else if(iFilter==2){ if (access(iValue,User)){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ speakto(User, sSound); } } } else if(iFilter==3){ if (iValue == iDead){ get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ speakto(User, sSound); } } } else { get_userinfo(User,"am_disablesounds",UserInfo,MAX_DATA_LENGTH); if (strtonum(UserInfo) != 1 || ForceSound > 1 ){ speakto(User, sSound); } } } } } return; } stock check_version(lower,upper){ new sValue[MAX_DATA_LENGTH]; new sNumber[MAX_DATA_LENGTH]; getstrvar("admin_mod_version",sValue, MAX_DATA_LENGTH); new j=0; for(new i=0;sValue[i] != 0 && j<5;i++){ if (sValue[i] >= '0' && sValue[i] <= '9' ){ sNumber[j] = sValue[i]; j++; } } while (j<5){ sNumber[j] = '0'; j++; } new Value = strtonum(sNumber); if (lower > Value || upper < Value){ return 0; /*Wrong version*/ } /*else*/ return 1; } /* if (strlen(Data) != 0){ if (getstrvar("vote_llama_freq",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","FIREARMS"); } else if (getstrvar("mp_c4timer",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","CSTRIKE"); } else if (getstrvar("mp_limitalliesspring",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","DOD"); } else if (getstrvar("wm_air_strike_on",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","WORMS"); } else if (getstrvar("lawtroop_limit",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","TOUROFDUTY"); } else if (getstrvar("mp_maxmolly",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","VAMPIRESLAYER"); } else if (getstrvar("tripmine_brightness",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","SUNLITSHLOFHORRORS"); } else if (getstrvar("si_balanceteams",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","SCIANDINDUSTRY"); } else if (getstrvar("Rocket_Crowbar_Version",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","ROCKETCROWBAR"); } else if (getstrvar("rc_arena",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","RICOCHET"); } else if (getstrvar("points_per_flag_steal",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","OZDM"); } else if (getstrvar("neotf",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","NEOTF"); } else if (getstrvar("tfc_clanbattle",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","TFC"); } else if (getstrvar("sv_wpedit",Data,MAX_DATA_LENGTH)){ set_vaultdata("MOD","ACTIONHL"); } else { set_vaultdata("MOD","UNKNOWN"); } get_vaultdata("MOD", Data, MAX_DATA_LENGTH); } */ /*Unknown = sven coop, wasteland, severians mod, OPForce, AG Somthing Jailbreak is a subset of TFC*/ stock slay_team(TeamNumber){ new TargetName[MAX_NAME_LENGTH],sAuthID[MAX_AUTHID_LENGTH],iTeam,iSessionID,iDead; for(new i=1; i<=maxplayercount(); i++) { strinit(TargetName); if(plrinfo(i,TargetName,MAX_NAME_LENGTH,iSessionID,sAuthID,iTeam,iDead)) { if(iTeam==TeamNumber && iDead==0) { if(check_immunity(TargetName)==0) { slay(TargetName); } } } } play_sound_to_all("ambience/thunder_clap.wav",1); return; } stock get_access(UserIndex){ new Total = 0; new User[MAX_NAME_LENGTH], sAuthID[MAX_AUTHID_LENGTH]; new SessionID,iTeam,iDead; if (plrinfo(UserIndex,User,MAX_NAME_LENGTH,SessionID,sAuthID,iTeam,iDead) ){ for(new i=1;i<=262144;i += i){ if (access(i,User)!=0){ Total += i; } } } else { return -1; } return Total; } stock isip(IP[]){ new Flag=0; new Dots=0; for(new i=0;IP[i]!=0;i++){ if ( !((IP[i] <= '9' && IP[i] >= '0') || IP[i]=='.' ) ){ Flag = 1; } else if (IP[i]=='.'){ Dots++; } } if (Dots==3){ return Flag; } return 0; } stock issteamid(SteamID[]){ if (strncasecmp(SteamID,"Steam_",6) == 0){ return 1; } return 0; } stock scrollsay(Text[],iR,iG,iB,ir,ig,ib,iType,iScrollspeed=-1,iMsglength=-1){ if (cavey_timer != 0){ kill_timer(cavey_timer); cavey_timer = 0; } if (cavey_isinit==0){ cavey_init(); } cavey_flicker_state=0; if (iMsglength<0){ cavey_scrollvars[1]=40; }else{ cavey_scrollvars[1]=iMsglength; } if (iScrollspeed<=0){ cavey_scrollvars[2]=2; }else{ cavey_scrollvars[2]=iScrollspeed; } cavey_scrollvars[0] = iType; cavey_colours[1] = iR; cavey_colours[2] = iG; cavey_colours[3] = iB; cavey_colours[4] = ir; cavey_colours[5] = ig; cavey_colours[6] = ib; strrep(Text, "^^n", " ", strlen(Text)); cavey_timer = set_timer("scroll_timer",1,0,Text); return 1; } public scroll_timer(Timer,Repeat,HLUser,HLParam){ new Data[MAX_DATA_LENGTH]; convert_string(HLParam,Data,MAX_DATA_LENGTH); new i,j; new Text[MAX_TEXT_LENGTH]; for (i=0;i<(cavey_scrollvars[1]-(cavey_flicker_state+1));i++){ Text[i]=' '; } j = cavey_flicker_state-cavey_scrollvars[1]; if (j<0){ j=0; } while (i<(cavey_scrollvars[1]) && Data[j]!=0){ Text[i++]=Data[j++]; } for (;i<(cavey_scrollvars[1]);i++){ Text[i]=' '; } Text[cavey_scrollvars[1]]='^0'; cavey_flicker_state+=cavey_scrollvars[2]; if(cavey_scrollvars[0]==0){ centersay(Text,2, cavey_colours[1],cavey_colours[2],cavey_colours[3]); } else if(cavey_scrollvars[0]==1){ typesay(Text,1, cavey_colours[1],cavey_colours[2],cavey_colours[3]); } else if(cavey_scrollvars[0]==2){ rainbow(Text,1, cavey_colours[1],cavey_colours[2],cavey_colours[3],cavey_colours[4],cavey_colours[5],cavey_colours[6]); } if (!(cavey_flicker_state>=( (cavey_scrollvars[1] + strlen(Data)) ) ) ){ cavey_timer = set_timer("scroll_timer",1,0,Data); } else { cavey_timer = 0; } return PLUGIN_HANDLED; } stock hlgsay(Text[],iTime){ return flickersay(Text,iTime,255,100,10,1,1,1); } stock flickersay(Text[],iTime,iR,iG,iB,ir,ig,ib){ if (cavey_timer != 0){ kill_timer(cavey_timer); cavey_timer = 0; } if (cavey_isinit==0){ cavey_init(); } cavey_flicker_state=0; cavey_colours[1] = iR; cavey_colours[2] = iG; cavey_colours[3] = iB; cavey_colours[4] = ir; cavey_colours[5] = ig; cavey_colours[6] = ib; cavey_timer = set_timer("flicker_timer",1,iTime,Text); return 1; } public flicker_timer(Timer,Repeat,HLUser,HLParam){ new Data[MAX_DATA_LENGTH]; convert_string(HLParam,Data,MAX_DATA_LENGTH); if (cavey_flicker_state == 1){ rainbow( Data, Timer, cavey_colours[1],cavey_colours[2],cavey_colours[3],cavey_colours[4],cavey_colours[5],cavey_colours[6]); cavey_flicker_state = 0; } else if (cavey_flicker_state == 0){ rainbow( Data, Timer,cavey_colours[4],cavey_colours[5],cavey_colours[6], cavey_colours[1],cavey_colours[2],cavey_colours[3]); cavey_flicker_state = 1; } if (Repeat<1){ kill_timer(cavey_timer); cavey_timer = 0; } return PLUGIN_HANDLED; }