Raised This Month: $ Target: $400
 0% 

Es_var + SM_msg...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avlisrotiv
Member
Join Date: May 2010
Old 08-10-2010 , 15:20   Es_var + SM_msg...
Reply With Quote #1

Any idea to resolve this?

Code:
    ServerCommand("es_xcopy valor sm_number");
    PrintToChat(client, "The var is: %s" "valor");
(This not work...)
The event_ is format by ES, but i need the message whit SM...
Any sugetion?

Tank's.
avlisrotiv is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-10-2010 , 15:45   Re: Es_var + SM_msg...
Reply With Quote #2

Could you give a little more information about what you're trying to do? You souldn't need to use EventScripts.
__________________
thetwistedpanda is offline
avlisrotiv
Member
Join Date: May 2010
Old 08-10-2010 , 16:00   Re: Es_var + SM_msg...
Reply With Quote #3

Quote:
Originally Posted by thetwistedpanda View Post
Could you give a little more information about what you're trying to do? You souldn't need to use EventScripts.
Is just like this (example):

Code:
ServerCommand("es_xcopy proximomapa ma_nextmap");
PrintToChat(client, "Next map is: %s" "proximomapa");
But it must be with the ES and SM!
ES to xcopy event (can not be with the SM), and SM to print the message to the client who used the command...

Or exist some way to use ES to retriving the message only for him? Like: "es_tell
client Next map is: event_var(proximomapa)"?
If yes, i can use: "ServerCommand(es_tel ... )".
But i don't know pass "client" to "userID", and the plugins is make for SM...

Last edited by avlisrotiv; 08-10-2010 at 16:03.
avlisrotiv is offline
PropKiller
Member
Join Date: Nov 2009
Location: South-East USA
Old 08-10-2010 , 16:08   Re: Es_var + SM_msg...
Reply With Quote #4

Would this work?
I am unsure of what you are wanting.
PHP Code:
    new String:valor[32];
    
GetCmdArg(1valorsizeof(valor));
    
    
StringToInt(valor);  
    
    
ServerCommand("es_xcopy %s"valor);
    
PrintToChat(client"The var is: %s"valor);
    return 
Plugin_Handled
You would do
!command "proximomapa ma_nextmap"
in chat.
And it would do
es_xcopy proximomapa ma_nextmap
from the server console.
__________________
Ent_Delete
Get points for completing surveys, get stuff for your points. Anything from iTunes cards, steam games, memberships to sites.
All legit!
PropKiller is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-10-2010 , 16:09   Re: Es_var + SM_msg...
Reply With Quote #5

You're making this a little harder than it has to be by trying to use EventScripts. Sourcemod can do everything EventScripts can better (and more efficiently but I can't back that claim up). If you want to determine the next map, there's a little native called GetNextMap that you can store the next map into. If you want to get the contents of a variable, like es_servervar, you should be able to GetConVarString/Int/Float/etc() to get that variable. To pass a userid to EventScripts that it can use, I believe you can use GetClientUserId(client); Something like ServerCommand("es_tell %d your mother smells of eldar berries", GetClientUserId(client));
__________________
thetwistedpanda is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-10-2010 , 16:24   Re: Es_var + SM_msg...
Reply With Quote #6

Quote:
Originally Posted by avlisrotiv View Post
Any idea to resolve this?

Code:
    ServerCommand("es_xcopy valor sm_number");
    PrintToChat(client, "The var is: %s" "valor");
(This not work...)
The event_ is format by ES, but i need the message whit SM...
Any sugetion?

Tank's.
The reason that isn't working is ServerCommand puts the command into the buffer, which is fired a frame later. PrintToChat is printing that variable before the es_xcopy command is executed.

Here is the same functionality in SourcePawn.

Code:
new Handle:hCvarSMNumber = FindConVar("sm_number");
if (hCvarSMNumber == INVALID_HANDLE)
{
    LogError("Cvar sm_number doesn't exist.");
    return;
}

decl String:strSMNumber[16];
GetConVarString(hCvarSMNumber, strSMNumber, sizeof(strSMNumber));
PrintToChat("The var is: %s", strSMNumber);
__________________
Greyscale is offline
avlisrotiv
Member
Join Date: May 2010
Old 08-10-2010 , 16:32   Re: Es_var + SM_msg...
Reply With Quote #7

Quote:
Originally Posted by PropKiller View Post
Would this work?
I am unsure of what you are wanting.
PHP Code:
    new String:valor[32];
    
GetCmdArg(1valorsizeof(valor));
    
    
StringToInt(valor);  
    
    
ServerCommand("es_xcopy %s"valor);
    
PrintToChat(client"The var is: %s"valor);
    return 
Plugin_Handled
You would do
!command "proximomapa ma_nextmap"
in chat.
And it would do
es_xcopy proximomapa ma_nextmap
from the server console.
Don't work!

PHP Code:
ServerCommand("es_xcopy tempvar ma_qualquer");
    new 
String:tempvar[32];
    
GetCmdArg(1tempvarsizeof(tempvar));
    
StringToInt(tempvar); 
    
CPrintToChat(client"[SM] The var is: %s"tempvar); 
????
This?

I just need print the copy of the var to the client who used the comand...
avlisrotiv is offline
avlisrotiv
Member
Join Date: May 2010
Old 08-10-2010 , 16:41   Re: Es_var + SM_msg...
Reply With Quote #8

Quote:
Originally Posted by Greyscale View Post
The reason that isn't working is ServerCommand puts the command into the buffer, which is fired a frame later. PrintToChat is printing that variable before the es_xcopy command is executed.

Here is the same functionality in SourcePawn.

Code:
new Handle:hCvarSMNumber = FindConVar("sm_number");
if (hCvarSMNumber == INVALID_HANDLE)
{
    LogError("Cvar sm_number doesn't exist.");
    return;
}

decl String:strSMNumber[16];
GetConVarString(hCvarSMNumber, strSMNumber, sizeof(strSMNumber));
PrintToChat("The var is: %s", strSMNumber);
Hum... The first time the plugin not show the var, but the second yes... Make some delay resolv? You can tell a example to delayed before the out message?
EDIT: The first time on commands say :
Unknown command: showthevar
But if i put the second time, the command, this works...
Some delay?

Last edited by avlisrotiv; 08-10-2010 at 16:46.
avlisrotiv is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 08-10-2010 , 17:02   Re: Es_var + SM_msg...
Reply With Quote #9

there's no point mixing es and sm, either do it in es alone or sm alone. i haven't coded in es since i switched to sm but theres an es command that stores the map name, something like eventscripts_nextmap. if you choose to do it in es alone you're better off asking for help on their forums.
blodia is offline
avlisrotiv
Member
Join Date: May 2010
Old 08-10-2010 , 17:26   Re: Es_var + SM_msg...
Reply With Quote #10

Quote:
Originally Posted by blodia View Post
there's no point mixing es and sm, either do it in es alone or sm alone. i haven't coded in es since i switched to sm but theres an es command that stores the map name, something like eventscripts_nextmap. if you choose to do it in es alone you're better off asking for help on their forums.

Forget "nextmap"... It's only an example...
And this plugins it's by to SM, not in ES... But i need the command es_xcopy to not fail on transp...
But forget the ES commands, i know the part of ES...

Now, everthing work perfectly... But, one thing...
When i put the EXAMPLE command, , the console says:
Unknown command: showthevar
But this works...

I have:
PHP Code:
public OnPluginStart()
{
    
RegConsoleCmd("showthevar"SomeChit);
}

public 
Action:SomeChit(clientargs)
{
    
ServerCommand("es_xcopy  sm_number ma_nextmap");
     
decl String:strSMNumber[30]; (this is the number of caractersright?)
     
GetConVarString(hCvarSMNumberstrSMNumbersizeof(strSMNumber));
     
PrintToChat("The var is: %s"strSMNumber);

Any idea to stop the error?

Last edited by avlisrotiv; 08-10-2010 at 17:31.
avlisrotiv 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 20:27.


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