This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Timer errors


Post New Thread Reply   
 
Thread Tools Display Modes
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 07-20-2009 , 12:27   Re: Timer errors
Reply With Quote #11

furthermore you don't need the next two lines of code as "client" is already
the client index.
FeuerSturm is offline
Rasmus4J
Junior Member
Join Date: Jul 2009
Location: Denmark, Kolding
Old 07-20-2009 , 12:46   Re: Timer errors
Reply With Quote #12

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(clientclient_namesizeof(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.0ChecknamekickclientTIMER_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(clientGetClientHealth(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:timerany:client)
{
    new 
client_id1 GetClientUserId(client)
    new 
client1 GetClientOfUserId(client_id1)
    
decl String:client_name1[256]
    
GetClientName(client1client_name1sizeof(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"0serverip)
        }
        else
        {
            
PrintToChat(client"Nice to see you having changed name")
        }
    }

Rasmus4J is offline
Send a message via MSN to Rasmus4J Send a message via Skype™ to Rasmus4J
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 15:29.


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