View Single Post
fard
AlliedModders Donor
Join Date: Dec 2015
Old 12-26-2015 , 16:41   Re: Namechecking, beginner question
Reply With Quote #6

string inc
Code:
/**
 * Tests whether a string is found inside another string.
 *
 * @param str			String to search in.
 * @param substr		Substring to find inside the original string.
 * @param caseSensitive	If true (default), search is case sensitive.
 *						If false, search is case insensitive.
 * @return				-1 on failure (no match found). Any other value
 *						indicates a position in the string where the match starts.
 */
native StrContains(const String:str[], const String:substr[], bool:caseSensitive=true);
Quote:
Originally Posted by Dr. Greg House View Post
It never did in SP.
I think it is true for some other languages/frameworks though (C#, Java?).
Position is >0 so its probably true in bool anyway

but I still have the problem
Code:
#include <sourcemod>
#include <string>

public Plugin myinfo =
{
	name = "test",
	author = "test",
	description = "My first plugin ever",
	version = "1.0",
	url = "http://www.sourcemod.net/"
}

public void OnPluginStart()
{
	PrintToServer("Nick checker enabled!");
}

public onClientConnected(client){
	char clientName[32];
	GetClientName(client, clientName, 32);
	if(StrContains(clientName, "test", false) != -1){
		PrintToServer("%s don't have test", clientName);
	}
	else{
		PrintToServer("%s have test", clientName);
	}
}
i dont have any text in console

Last edited by fard; 12-26-2015 at 16:44.
fard is offline