Raised This Month: $ Target: $400
 0% 

Getting Errors For Script I Wrote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nspcta
Junior Member
Join Date: Dec 2009
Old 12-09-2009 , 04:17   Getting Errors For Script I Wrote
Reply With Quote #1

Script would basically, slay anyone that has nto moved within 30 seconds, but it
has too many errors on line 21 and 22 anyone help?
PHP Code:
public Plugin:myinfo 
{
    
name "AFK Slayer",
    
author "nspcta",
    
description "Slays AFK'ers who are afk for more than 30 seconds",
    
version "1.0",
    
url "www.sourcemod.com"
}

public 
OnPluginStart()
{
    
HookEventEx("player_spawn"OnPlayerSpawnEventHookMode_Post)
}

public 
OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
native bool:GetClientName(clientString:name[0], maxlen);
    
GetClientAbsOrigin(clientFloat;vec[3])
    
CreateTimer(30.0AFKill)
}
public 
AFkill(Handle:event, const String:SilentChatTrigger[12], bool:dontBroadcast
{
    
GetClientAbsOrigin(clientFloat:vec[3]) 
    if 
GetClientAbsOrigin(clientFloat:vec[3]) = same
        
{
            
ServerCommand ("sm_slay #%i"client)
        }

Nspcta is offline
Liniarian
Member
Join Date: Jul 2009
Old 12-09-2009 , 08:19   Re: Getting Errors For Script I Wrote
Reply With Quote #2

public AFkill(Handle:event, const String:SilentChatTrigger[12], bool:dontBroadcast
You forgot 1 ) in the end ;)

should be public AFkill(Handle:event, const String:SilentChatTrigger[12], bool:dontBroadcast)
Liniarian is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-09-2009 , 09:50   Re: Getting Errors For Script I Wrote
Reply With Quote #3

Lol you're doing almost everything in there wrong, hold on fixing.

Edit: nevermind, got busy x_x

Last edited by Dragonshadow; 12-09-2009 at 18:40.
Dragonshadow is offline
SilentLikeSilence
Senior Member
Join Date: Jul 2009
Old 12-09-2009 , 14:07   Re: Getting Errors For Script I Wrote
Reply With Quote #4

You should use Action tag after public on the timer and on the hooked event.

PHP Code:
public Action:*eventcallback*(Handle:event, const String:name[], bool:dontBroadcast)

public 
Action:*timercallback*(Handle:timerany:client
EDIT:Tested and works
Attached Files
File Type: sp Get Plugin or Get Source (afkslayerfix.sp - 425 views - 1.4 KB)

Last edited by SilentLikeSilence; 12-09-2009 at 15:00.
SilentLikeSilence is offline
Nspcta
Junior Member
Join Date: Dec 2009
Old 12-09-2009 , 16:43   Re: Getting Errors For Script I Wrote
Reply With Quote #5

Thanks Alot Guys, Works Perfectly... =] Thank you So Much VERY VERY Appreciated
Nspcta is offline
Nspcta
Junior Member
Join Date: Dec 2009
Old 12-10-2009 , 19:41   Re: Getting Errors For Script I Wrote
Reply With Quote #6

Quote:
Originally Posted by SilentLikeSilence View Post
You should use Action tag after public on the timer and on the hooked event.

PHP Code:
public Action:*eventcallback*(Handle:event, const String:name[], bool:dontBroadcast)

public 
Action:*timercallback*(Handle:timerany:client
EDIT:Tested and works
Only Seems to be killing Terrorists, what about CT's in gun room? Please help cant find where you put team == 2
Nspcta is offline
Wazz
SourceMod Donor
Join Date: Mar 2009
Old 12-11-2009 , 08:36   Re: Getting Errors For Script I Wrote
Reply With Quote #7

P.S: You only need an action tag on event hooks using EventHookMode_Pre. EventHookMode_Post ignores any returns.
Wazz is offline
SilentLikeSilence
Senior Member
Join Date: Jul 2009
Old 12-11-2009 , 09:55   Re: Getting Errors For Script I Wrote
Reply With Quote #8

That kills CTs and Ts too if you didn't modify anything.

If you want to slap just a specific team:

PHP Code:
public Action:CheckForAfk(Handle:timerany:client)
{
    new 
team GetClientTeam(client);

    
decl String:name[32];
    
GetClientName(clientnamesizeof(name));

    
GetClientEyePosition(clientCurrentPos[client]);
 
    if(
SpawnPos[client][0] == CurrentPos[client][0]
    && 
SpawnPos[client][1] == CurrentPos[client][1]
    && 
SpawnPos[client][2] == CurrentPos[client][2]) 
    {
        if(
team == 2//Replace the number with the index of team
        
{
            
SlapPlayer(client100false);
            
PrintToChatAll("\x04Player %s was AFK and was slaped."name)
        }
    }

    return 
Plugin_Continue;


Last edited by SilentLikeSilence; 12-11-2009 at 10:00.
SilentLikeSilence 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 14:15.


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