Raised This Month: $51 Target: $400
 12% 

Desvirtúe aquí.


  
 
 
Thread Tools Display Modes
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-29-2010 , 12:56   Re: [ES] El Offtopic va ACA! (con reglas)
#6861

Te estas fijando en la carpeta "logs" dentro de amxmodx? Y otra cosa, esa funcion crea el archivo si no existe? no me acuerdo de eso.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Asdito´^
Veteran Member
Join Date: Feb 2010
Location: Santa Fe, Argentina
Old 09-29-2010 , 12:57   Re: [ES] El Offtopic va ACA! (con reglas)
#6862

PHP Code:
public client_connect(id)
{
    new 
szName[32//
    
get_user_name(idszName31)// 
    
    
ArraySetString(topasoidszName)

seguro el debug te habra tirado index out bounds
__________________
################################
Asdito´^ is offline
Send a message via MSN to Asdito´^
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 13:00   Re: [ES] El Offtopic va ACA! (con reglas)
#6863

Quote:
Originally Posted by Alucard^ View Post
Te estas fijando en la carpeta "logs" dentro de amxmodx? Y otra cosa, esa funcion crea el archivo si no existe? no me acuerdo de eso.
Si, lo crea si no existe

Quote:
Originally Posted by Asdito´^ View Post
PHP Code:
public client_connect(id)
{
    new 
szName[32//
    
get_user_name(idszName31)// 
    
    
ArraySetString(topasoidszName)

seguro el debug te habra tirado index out bounds
Quote:
L 09/29/2010 - 13:59:45: Invalid cellvector handle provided (106:1:0)
L 09/29/2010 - 13:59:45: [AMXX] Displaying debug trace (plugin "test.amxx")
L 09/29/2010 - 13:59:45: [AMXX] Run time error 10: native error (native "ArraySetString")
L 09/29/2010 - 13:59:45: [AMXX] [0] temp809.sma::client_connect (line 16)
Raddish is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-29-2010 , 13:02   Re: [ES] El Offtopic va ACA! (con reglas)
#6864

Quote:
Originally Posted by Asdito´^ View Post
PHP Code:
public client_connect(id)
{
    new 
szName[32//
    
get_user_name(idszName31)// 
    
    
ArraySetString(topasoidszName)

seguro el debug te habra tirado index out bounds

Nono, eso esta bien... solo que esta usando una celda de mas, al pedo... pero no esta mal.

Igual ahora que lo veo los parametros que uso en ArrayGetString y ArraySetString estan mal...

Code:
/**  * Returns a string value from an array.  *  * @param which   The array to retrieve the item from.  * @param item      The item to retrieve (zero-based).  * @param output        The variable to store the value in.  * @param size      Character size of the output buffer.  */ native ArrayGetString(Array:which, item, output[], size); /**  * Sets an item's data with that of a local buffer.   * The buffer size must match what the cellsize that the array was created with!  * The item must already exist, use ArrayPushArray to create a new item within the array.  *  * @param which   The array to set the item from within.  * @param item      The item to set (zero-based).  * @param input   The input buffer to store.  */ native ArraySetArray(Array:which, item, const any:input[]);

No se por que en el segundo parametro pusiste la id XD... si no necesitas la id del player para guardar datos dentro de una variable.

Lo que tenes que hacer crear una variable global e ir aumentando esa variable en el client connect. (esa variable seria el parametro "item").
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 13:04   Re: [ES] El Offtopic va ACA! (con reglas)
#6865

El id supongo que es un numero, por eso lo puse, dsp "tomo" la informacion con el mismo id (numero).

Igual ahora que pienso, el numero creo que tiene que ser entre 0 y 32.
Raddish is offline
Nameles-s
BANNED
Join Date: Aug 2010
Location: Cordoba
Old 09-29-2010 , 13:11   Re: [ES] El Offtopic va ACA! (con reglas)
#6866

Murio Romina Yan
Nameles-s is offline
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 13:14   Re: [ES] El Offtopic va ACA! (con reglas)
#6867

Quote:
Originally Posted by Raddish View Post
El id supongo que es un numero, por eso lo puse, dsp "tomo" la informacion con el mismo id (numero).

Igual ahora que pienso, el numero creo que tiene que ser entre 0 y 32.
Dios, tampoco eso º_º

PHP Code:
#include <amxmodx>
#include <amxmisc>

new Array:topaso
new Connected
new Myid[33]

public 
plugin_init()
{
    
topaso ArrayCreate(331)
}

public 
client_connect(id)
{
    
Connected++
    
Myid[id] = Connected
    
    
new szName[33]
    
get_user_name(idszName32)
    
    
ArraySetString(topasoMyid[id], szName)
}

public 
client_disconnect(id)
{
    new 
szOut[33]
    
ArrayGetString(topasoMyid[id], szOutcharsmax(szOut))
    
    
log_to_file("disconnected.txt"szOut)
    
    
Connected--

Quote:
L 09/29/2010 - 14:12:59: Invalid cellvector handle provided (106:1:0)
L 09/29/2010 - 14:12:59: [AMXX] Displaying debug trace (plugin "test.amxx")
L 09/29/2010 - 14:12:59: [AMXX] Run time error 10: native error (native "ArraySetString")
L 09/29/2010 - 14:12:59: [AMXX] [0] test.sma::client_connect (line 21)
L 09/29/2010 - 14:13:13: Invalid cellvector handle provided (106:1:0)
L 09/29/2010 - 14:13:13: [AMXX] Displaying debug trace (plugin "test.amxx")
L 09/29/2010 - 14:13:13: [AMXX] Run time error 10: native error (native "ArrayGetString")
L 09/29/2010 - 14:13:13: [AMXX] [0] test.sma::client_disconnect (line 27)
Dropped HLTV Proxy from server
Reason: Client sent 'drop'
=/
Raddish is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-29-2010 , 13:23   Re: [ES] El Offtopic va ACA! (con reglas)
#6868

Para, que es lo que queres hacer?
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 13:24   Re: [ES] El Offtopic va ACA! (con reglas)
#6869

Quote:
Originally Posted by Alucard^ View Post
Para, que es lo que queres hacer?
Estoy probando como utilizar arrays, para dsp hacer cosas en el futuro XD

Quiero guardar el nombre del chabonsito en una array, y despues cuando se desconecta tomar el nombre desde el array, y ponerlo en un log. (algo simple pero dsp me podria servir para distintas cosas).
Raddish is offline
Asdito´^
Veteran Member
Join Date: Feb 2010
Location: Santa Fe, Argentina
Old 09-29-2010 , 13:28   Re: [ES] El Offtopic va ACA! (con reglas)
#6870

PHP Code:
#include < amxmodx >
#include < amxmisc >

const TASK_ID_REMOVE 1337;

new Array:
g_aReconnectSteamIDs;
new 
Trie:g_tArrayPos;
new 
g_iArraySize;

public 
plugin_init( )
{
    
g_aReconnectSteamIDs ArrayCreate35 );
    
g_tArrayPos TrieCreate( );
}

public 
plugin_end( )
{
    
ArrayDestroyg_aReconnectSteamIDs );
    
TrieDestroyg_tArrayPos );
}

public 
client_authorizedclient )
{
    static 
szAuthid35 ];
    
get_user_authidclientszAuthid34 );
    
    static 
iArrayPos;
    if( !
TrieGetCellg_tArrayPosszAuthidiArrayPos ) )
    {
        return;
    }
    
    
// client reconnected
    
    
RemoveReconnectszAuthidiArrayPos )
}

public 
client_disconnectclient )
{
    static 
szAuthid35 ];
    
get_user_authidclientszAuthid34 );
    
    
set_task60.0"TaskRemoveReconnect"TASK_ID_REMOVE AddReconnectszAuthid ) );
}

public 
TaskRemoveReconnectiTaskId )
{
    
RemoveReconnect_, ( iTaskId TASK_ID_REMOVE ) );
}

AddReconnectszGivenAuthid[ ] )
{
    static 
szAuthid35 ], iArrayPos;
    
    for( 
iArrayPos 0iArrayPos g_iArraySizeiArrayPos++ )
    {
        
ArrayGetStringg_aReconnectSteamIDsiArrayPosszAuthid34 );
        
        if( !
szAuthid] )
        {
            
ArraySetStringg_aReconnectSteamIDsiArrayPosszGivenAuthid );
            
TrieSetCellg_tArrayPosszGivenAuthidiArrayPos );
            
            return 
iArrayPos;
        }
    }
    
    
iArrayPos g_iArraySize++;
    
    
ArrayPushStringg_aReconnectSteamIDsszGivenAuthid );
    
TrieSetCellg_tArrayPosszGivenAuthidiArrayPos );
    
    return 
iArrayPos;
}

RemoveReconnectszGivenAuthid[ ]=""iGivenArrayPos=-)
{
    static 
szAuthid35 ], iArrayPos;
    
copyszAuthid34szGivenAuthid );
    
iArrayPos iGivenArrayPos;
    
    if( !
szAuthid] )
    {
        if( 
iArrayPos )
        {
            return;
        }
        
        
ArrayGetStringg_aReconnectSteamIDsiArrayPosszAuthid34 );
    }
    else if( 
iArrayPos )
    {
        if( !
TrieGetCellg_tArrayPosszAuthidiArrayPos ) )
        {
            return;
        }
    }
    
    
ArraySetStringg_aReconnectSteamIDsiArrayPos"" );
    
TrieDeleteKeyg_tArrayPosszAuthid );
    
    
remove_taskTASK_ID_REMOVE iArrayPos );

Es de Exolent.
Entendi que pone el setstring dentro de un loop pero lo demas no.
__________________
################################
Asdito´^ is offline
Send a message via MSN to Asdito´^
 



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 02:36.


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