Raised This Month: $51 Target: $400
 12% 

[Solved] Please fix it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
goldenbuick707
Member
Join Date: Jun 2015
Old 06-28-2015 , 13:28   [Solved] Please fix it
Reply With Quote #1

Reverted post; please don't blank when you solved your problem - RedSword

Can someone fix this code?
It's for multi-targets

@admins (who have "b" flag)
@nonadmins (who don't have "b" flag)
@vips (who have "s" flag)
@nonvips (who don't have "s" flag)

Code:

PHP Code:
#pragma semicolon 1

// ====[ INCLUDES ]============================================= ===============
#include <sourcemod>
#include <tf2_stocks>

// ====[ DEFINES ]============================================= ================
#define PLUGIN_NAME "Admin Targets"
#define PLUGIN_VERSION "1.3"

public Plugin:myinfo 
{
name "PLUGIN_NAME",
author "Infection",
description "Multi targets",
version "PLUGIN_VERSION",
url ""
}

public 
APLRes:AskPluginLoad2(Handle:hMyselfbool:bLateString:strError[], iErrMax)
{
decl String:strGame[32];
GetGameFolderName(strGamesizeof(strGame));

if(!
StrEqual(strGame"tf"))
{
Format(strErroriErrMax"This plugin only works for Team Fortress 2");
return 
APLRes_Failure;
}

return 
APLRes_Success;
}

public 
OnPluginStart()
{
AddMultiTargetFilter("@admins"MultiTargetFilter"all admins"false);
AddMultiTargetFilter("@nonadmins"MultiTargetFilter"all but admins not"false);
AddMultiTargetFilter("@vips"MultiTargetFilter"all vips"false);
AddMultiTargetFilter("@nonvips"MultiTargetFilter"all but vips not"false);
}

public 
OnPluginEnd()
{
RemoveMultiTargetFilter("@admins"MultiTargetFilter);
RemoveMultiTargetFilter("@nonadmins"MultiTargetFilter);
RemoveMultiTargetFilter("@vips"MultiTargetFilter);
RemoveMultiTargetFilter("@nonvips"MultiTargetFilter);
}

public 
bool:MultiTargetFilter(const String:strPattern[], Handle:hClients)
{
new 
bool:bOpposite;
if(
StrContains(strPattern"!") != -1)
bOpposite true;

new 
AdminType:Admin ADMFLAG_GENERIC
if(StrContains(strPattern"ad"false) != -1)
Admin ADMFLAG_GENERIC;
else if(
StrContains(strPattern"na"false) != -1)
Admin ADMFLAG_NONE;
else if(
StrContains(strPattern"vi"false) != -1)
Admin ADMFLAG_CUSTOM5;
else if(
StrContains(strPattern"nv"false) != -1)
Admin ADMFLAG_NONE;

for(new 
1<= MaxClients++) if(IsClientInGame(i))
{
if(
GetAdminFlag(i))
continue;

if(
GetAdminFlag(i) != Admin)
continue;

if(
GetAdminFlag(i) == Admin)
continue;

if(
Admin && GetAdminFlag(i) != Admin)
continue;

PushArrayCell(hClientsi);
}

return 
true;

ERRORS:
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(57) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(57) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(5 : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(60) : error 017: undefined symbol "ADMFLAG_NONE"
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(60) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(62) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(64) : error 017: undefined symbol "ADMFLAG_NONE"
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(64) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(6 : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(6 : error 092: number of arguments does not match definition
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(71) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(71) : error 092: number of arguments does not match definition
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(74) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(74) : error 092: number of arguments does not match definition
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(77) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(77) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(77) : error 092: number of arguments does not match definition
/home/groups/sourcemod/upload_tmp/phpGD34Ts.sp(54) : warning 204: symbol is assigned a value that is never used: "bOpposite"

BTW I don't know how to code someone with no flags, so i just wrote "ADMFLAG_NONE",
So please fix.

Thanks for who helps.

Note: the author solved his problem (he blanked his post too) - RedSword

Last edited by RedSword; 07-01-2015 at 00:01. Reason: Reverted post blanking + marked as solved
goldenbuick707 is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-29-2015 , 02:32   Re: Please fix it
Reply With Quote #2

I havent looked at your code, but here is a sample filter I made a while back that I've used in servers:

Spoiler


It contains already the first two you mentioned, and adding the second two would be simple copy/paste/replace, where "s" flag is ADMFLAG_CUSTOM5.
__________________

Last edited by ThatOneGuy; 06-29-2015 at 19:54.
ThatOneGuy is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-29-2015 , 20:01   Re: Please fix it
Reply With Quote #3

Also, do not cross-post in multiple forums sections/threads. It is a good way to get forum banned. You can read the forum rules here: https://forums.alliedmods.net/misc.php?do=showrules

Regarding: https://forums.alliedmods.net/showthread.php?t=265472
__________________
ThatOneGuy is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 06-29-2015 , 20:28   Re: Please fix it
Reply With Quote #4

Code:
public bool:MultiTargetFilter(const String:strPattern[], Handle:hClients) {     new bool:bOpposite;     if(StrContains(strPattern, "!") != -1)         bOpposite = true;     new Admin = ADMFLAG_GENERIC;  //CHANGED THIS LINE     if(StrContains(strPattern, "ad", false) != -1)         Admin = ADMFLAG_GENERIC;     else if(StrContains(strPattern, "na", false) != -1)         Admin = -1//CHANGED THIS LINE     else if(StrContains(strPattern, "vi", false) != -1)         Admin = ADMFLAG_CUSTOM5;     else if(StrContains(strPattern, "nv", false) != -1)         Admin = -1//CHANGED THIS LINE     for(new i = 1; i <= MaxClients; i ++) if(IsClientInGame(i))     {         if(GetAdminFlag(i))             continue;         if(GetAdminFlag(i) != Admin)             continue;         if(GetAdminFlag(i) == Admin)             continue;         if(Admin > 0 && GetAdminFlag(i) != Admin)             continue;         PushArrayCell(hClients, i);     }     return true; }
There's still more than a few problems:
1. GetAdminFlag needs 2 parameters: https://sm.alliedmods.net/api/index....d=show&id=522&
2. It doesn't look like you'll ever push a client index in that for loop because you're continuing both when the client is an admin and when the client isn't an admin
3. You never use bOpposite
__________________
~Wliu
Wliu is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-29-2015 , 21:46   Re: Please fix it
Reply With Quote #5

WliU, based on the PM he sent me, I think he just used mine as a template to start from. His has a lot of bugs, several of which were summarized in his errors he posted (missing semicolons, bad syntax, etc), but I think he might be good now. Alternately, people posted in his other thread he made.
__________________
ThatOneGuy is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-30-2015 , 19:28   Re: Please fix it
Reply With Quote #6

Some ppl don't deserve help.

eg. This op does the following.

1. Selfish: Removes their questions saying they have solved there problem
2. Impatient: bumps posts
3. Impatient: spams pms to community members.

I have a message for the OP.

STOP BEING A SELFISH IMPATIENT PRICK AND READ THE FORUM RULES.
__________________
Neuro Toxin is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-30-2015 , 20:00   Re: Please fix it
Reply With Quote #7

Wow...he did it on this thread as well? Where is the forum ban already?
__________________
ThatOneGuy is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 06-30-2015 , 22:10   Re: Please fix it
Reply With Quote #8

Quote:
Originally Posted by Neuro Toxin View Post
Some ppl don't deserve help.
+1.

Quote:
Originally Posted by ThatOneGuy View Post
Wow...he did it on this thread as well?
Also on this thread, indeed.

Quote:
Originally Posted by ThatOneGuy View Post
Where is the forum ban already?
Report Post button works for that, I guess. :-)
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-30-2015 , 23:05   Re: Please fix it
Reply With Quote #9

Quote:
Originally Posted by arne1288 View Post
Report Post button works for that, I guess. :-)
I reported one of his posts soon after I said that. It seemed excessive to report him 11 times though.

EDIT: Seconds after posting this, I noticed he is banned, lol.
__________________

Last edited by ThatOneGuy; 06-30-2015 at 23:06.
ThatOneGuy is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 07-01-2015 , 08:34   Re: Please fix it
Reply With Quote #10

Quote:
Originally Posted by ThatOneGuy View Post
I reported one of his posts soon after I said that. It seemed excessive to report him 11 times though.

EDIT: Seconds after posting this, I noticed he is banned, lol.
That makes it at least 3 reports:

I reported one post for being "blanked out", then like 5-10m after, I saw another one with the same issue, and same poster.. So I also reported that one, though saying in the latter one that it appears a million posts from this user is just being blanked out, etc...
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode