Raised This Month: $32 Target: $400
 8% 

Tag Mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
matt12mjc
New Member
Join Date: Jan 2015
Old 01-27-2015 , 19:33   Tag Mismatch
Reply With Quote #1

Im trying to create a simple plugin that will display text on the screen but I accidentally created the command as a RegConsoleCmd instead of a RegServerCmd, and I need the server to execute the command. I tried changing "RegConsoleCmd" to "RegServerCmd" and removing "client" next to args but I keep getting errors. Can anyone help me?

#pragma semicolon 1
#include <sourcemod>
public OnPluginStart()
{
RegServerCmd("livee", asdf);
}
public Action:asdf(args)
{
new Handle:hHudText = CreateHudSynchronizer();
SetHudTextParams(-1.0, 0.2, 4.85, 255, 0, 0, 255);
ShowSyncHudText(hHudText, "TEXT TEST");
CloseHandle(hHudText);
return Plugin_Handled;
}
--------------------------------------------------------------------------------------------------------------
/home/groups/sourcemod/upload_tmp/phpODDUac.sp(14) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpODDUac.sp(14) : error 035: argument type mismatch (argument 2)

Last edited by matt12mjc; 01-27-2015 at 19:34.
matt12mjc is offline
nomy
Senior Member
Join Date: Dec 2009
Location: United Kingdom
Old 01-27-2015 , 20:33   Re: Tag Mismatch
Reply With Quote #2

PHP Code:
#pragma semicolon 1
#include <sourcemod>

new Handle:hHudText INVALID_HANDLE;

public 
OnPluginStart()
{
    
RegServerCmd("livee"asdf);
    
hHudText CreateHudSynchronizer();
}

public 
Action:asdf(args)
{
    for (new 
i=1i<=MaxClientsi++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i))
        {
            if(
hHudText != INVALID_HANDLE)
            {
                
SetHudTextParams(-1.00.24.8525500255);
                
ShowSyncHudText(ihHudText"TEXT TEST");
            }
        }
    }
    return 
Plugin_Handled;


Last edited by nomy; 01-27-2015 at 22:27. Reason: Corrected
nomy is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 01-27-2015 , 21:56   Re: Tag Mismatch
Reply With Quote #3

Forget that IsValidClient stock, just use IsClientInGame. You already know that i will be greater than 0 and less than MaxClients+1, and IsClientInGame already checks to see if the client is connected first.
bl4nk is offline
nomy
Senior Member
Join Date: Dec 2009
Location: United Kingdom
Old 01-27-2015 , 22:27   Re: Tag Mismatch
Reply With Quote #4

Thanks, I have updated the post.
nomy is offline
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 01-27-2015 , 22:51   Re: Tag Mismatch
Reply With Quote #5

Quote:
Originally Posted by bl4nk View Post
Forget that IsValidClient stock, just use IsClientInGame. You already know that i will be greater than 0 and less than MaxClients+1, and IsClientInGame already checks to see if the client is connected first.
Does it waste performance when using IsValidClient stock?
lingzhidiyu is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 01-27-2015 , 23:50   Re: Tag Mismatch
Reply With Quote #6

Quote:
Originally Posted by lingzhidiyu View Post
Does it waste performance when using IsValidClient stock?
All unnecessary calculation will impact performance, although this impact is incredibly negligible.
__________________
ddhoward 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 16:22.


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