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

if contains


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-Striker-
Member
Join Date: Jun 2010
Old 07-22-2010 , 08:29   if contains
Reply With Quote #1

Hello,

i havent found it on google or here: http://wiki.alliedmods.net/Introduction_to_SourcePawn

My question ist now, how can i use operators like "CONTAINS".
I have already a few lines to check the text on "player_say".
Now i want to check, if there is a "!" or a "@" in the text.

Thank you for replys.
-Striker- is offline
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 07-22-2010 , 08:41   Re: if contains
Reply With Quote #2

http://docs.sourcemod.net/api/
StrContains
Chrisber is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 07-22-2010 , 08:48   Re: if contains
Reply With Quote #3

or if it gets more complicated with a regex match.
__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
-Striker-
Member
Join Date: Jun 2010
Old 07-22-2010 , 09:11   Re: if contains
Reply With Quote #4

Ah... thank you.
A lot of commands ^^

-A last question: How can i send messages to dead players only?
-Striker- is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 07-22-2010 , 09:49   Re: if contains
Reply With Quote #5

PHP Code:
for (new 1<= GetClientCount(); i++)
{
    if (
IsFakeClient(i) || !IsClientInGame(i) || !IsClientConnected(i))
        continue;

    if (!
IsPlayerAlive(i))
    {
        
PrintToChat(i"Some Message");
    }

__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
-Striker-
Member
Join Date: Jun 2010
Old 07-22-2010 , 09:56   Re: if contains
Reply With Quote #6

Okay, now iam get this hints:

Code:
"C:\Users\Finn\Documents\Offizial ISC Folder\Pawn\chatedit.sp(50) : error 001: expected token: ",", but found ";"

C:\Users\Finn\Documents\Offizial ISC Folder\Pawn\chatedit.sp(50) : error 029: invalid expression, assumed zero

C:\Users\Finn\Documents\Offizial ISC Folder\Pawn\chatedit.sp(50) : warning 215: expression has no effect"
To this:
ssContainss = StrContains(sssMessage, aolat);

Code under includes:
#define aolat "@";
new String:sssMessage[27];
new ssContains;
-Striker- is offline
neo_gis
Member
Join Date: Sep 2009
Location: Rabat
Old 07-22-2010 , 10:10   Re: if contains
Reply With Quote #7

i suggest you read carefully the wiki to sourcepawn along with its examples .
__________________
neo_gis is offline
Send a message via MSN to neo_gis Send a message via Skype™ to neo_gis
-Striker-
Member
Join Date: Jun 2010
Old 07-22-2010 , 12:54   Re: if contains
Reply With Quote #8

okay, thank you.
I have it so far!

I have read YAKs FAQs
-Striker- is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 07-22-2010 , 17:29   Re: if contains
Reply With Quote #9

neo_gis, you dont need:!IsClientInGame(i) || !IsClientConnected(i)
just one or the other - and since you most likely want InGame, just that. its only been mentioned about 10,000,000,000,000 times: if InGame, Connected is already true.
dirka_dirka is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 07-22-2010 , 18:16   Re: if contains
Reply With Quote #10

I think I've mentioned that about 10,000,000,000,001 times.

IsClientConnected rarely ever needs to be used unless you want to do stuff to a player in the loading screen.
__________________
Greyscale 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 11:37.


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