now it compiles just, but when in use, it's not so fine.. :/
before i made the timer part today, it responded to my name, now it doesn't, and it says there's an error: Invalid data handle 1 (error 1) passed during timer end with TIMER_DATA_HNDL_CLOSE ?
PHP Code:
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Koshy, kick/praise",
author = "CA | Ramsus [DK]",
description = "This will on player_spawn look for names containing words like: Koshy, hate, love, if found an action will be done",
version = "0.1",
url = ""
}
public OnPluginStart()
{
HookEvent("player_spawn", SpawnEvent)
HookEvent("player_changename", ChangenameEvent)
}
public Action:SpawnEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
new client_id = GetEventInt(event, "userid")
new client = GetClientOfUserId(client_id)
decl String:client_name[256]
GetClientName(client, client_name, sizeof(client_name))
if (StrContains(client_name, "Koshy", false)!=-1)
{
if (StrContains(client_name, "love", false)!=-1)
{
PrintToChat(client, "You have the words: Koshy & love, in your name. You have 1 minute to change it or get kicked!")
CreateTimer(60.0, Checknamekick, client, TIMER_HNDL_CLOSE);
}
}
if (StrContains(client_name, "Koshy", false)!=-1)
{
if (StrContains(client_name, "hate", false)!=-1)
{
PrintToChat(client, "You have the words: Koshy & hate, in your name, this you will be rewarded for :)")
SetEntityHealth(client, GetClientHealth(client) + 20)
PrintToChat(client, "You received 20 health points for having the words: Koshy & hate, in your name.")
}
}
}
public Action:ChangenameEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
PrintToChat(client( "hi, i see you just changed your name, want any help?")
}
public Action:Checknamekick(Handle:timer, any:client)
{
new client_id1 = GetClientUserId(client)
new client1 = GetClientOfUserId(client_id1)
decl String:client_name1[256]
GetClientName(client1, client_name1, sizeof(client_name1))
if (StrContains(client_name1, "Koshy", false)!=-1)
{
if (StrContains(client_name1, "love", false)!=-1)
{
PrintToChat(client, "You have the words: Koshy & love, in your name. You have 1 minute to change it or get kicked!")
PrintToChatAll("%s has the words: Koshy & love, in his/her name, lets all point fingers and say bye bye! :D")
PrintToChat(client, "You will now be kicked!")
decl String:serverip[128]
KickClient(client, "You have been kicked from server %s for having the words Koshy and Love in your name", 0, serverip)
}
else
{
PrintToChat(client, "Nice to see you having changed name")
}
}
}