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

Algun tutorial de arrays?


  
 
 
Thread Tools Display Modes
Author Message
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-22-2010 , 18:21   Algun tutorial de arrays?
#1

Alguien me pasa algun tutorial de arrays, no lo encuentro =/

lo de ArrayCreate
ArrayPushCell
ArrayPushString

Last edited by Raddish; 09-29-2010 at 12:43.
Raddish is offline
Old 09-22-2010, 18:48
zp_bug
This message has been deleted by zp_bug. Reason: 1
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 12:42   Re: [ES] Algun tutorial de arrays?
#2

bump! (22 al 29) 7 dias jJOJEHEHJEHE P:
Raddish is offline
nike!
Senior Member
Join Date: May 2009
Location: Melmac
Old 09-29-2010 , 13:00   Re: [ES] Algun tutorial de arrays?
#3

Ahora te busco uno radish, pero si me haces 2 x 1 con las verduras jaja
__________________
nike"
nike! is offline
Send a message via MSN to nike!
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 13:01   Re: [ES] Algun tutorial de arrays?
#4

Quote:
Originally Posted by nike! View Post
Ahora te ago uno radish, pero si me haces 2 x 1 con las verduras jaja
gordo gay te ban a banear por spam XD
Raddish is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-29-2010 , 13:06   Re: [ES] Algun tutorial de arrays?
#5

Ni idea y ni ganas de buscarlo pero quizas esto te sirva... no esta terminado pero me acuerdo que la ultima vez que lo probe funco. Ahi use Arrays dinamicos...

PHP Code:
/* Special credits to Exolent for his Entity Remover */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN    "Entity Remover in Sphere"
#define AUTHOR    "Alucard"
#define VERSION    "0.0.1"

#define MAX_ENTS 5
#define MAX_ENTS_REMOVE 20

#define TASK_ID_CHECK 9999

#define RADIO 50.0

new const ENTS_REMOVED[] = "addons/amxmodx/configs/ERS";

new 
entTarget[33][MAX_ENTS];

new Array:
gClass;
new Array:
gModel;

new 
mapName[48], entsFile[128];

new 
TotalEnts;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_concmd("ers_remove""HookCmdRemove"ADMIN_KICK);
    
register_concmd("ers_reset""HookCmdReset"ADMIN_KICK);
}

public 
plugin_precache()
{
    if(!
dir_exists(ENTS_REMOVED) )
        
mkdir(ENTS_REMOVED);
    
    
gClass ArrayCreate(321);
    
gModel ArrayCreate(321);
    
    
get_mapname(mapNamecharsmax(mapName) );
    
formatex(entsFile127"%s/%s.cfg"ENTS_REMOVEDmapName);
    
    
LoadEntsRemoved();
    
    
register_forward(FM_Spawn"HookFmSpawn"0);
}

public 
HookFmSpawn(ent)
{
    if(
is_valid_ent(ent) )
    {
        
//log_amx("FM_SPAWN");
        
        
new szClass[32], szModel[32];
        
entity_get_string(entEV_SZ_classnameszClass31);
        
entity_get_string(entEV_SZ_modelszModel31);
        
        
log_amx("FM_SPAWN totalents %d"TotalEnts);
        
        new 
loadClass[32], loadModel[32];
        for(new 
0TotalEntsi++)
        {
            
log_amx("FM_SPAWN ents %d"i);
            
            
ArrayGetString(gClassiloadClass32);
            
ArrayGetString(gModeliloadModel32);
            
            if(
equal(szClassloadClass) && equal(szModelloadModel) )
            {
                
log_amx("FM_SPAWN class: %s %s"szClassloadClass);
                
remove_entity(ent);
            }
        }
    }
}

public 
HookCmdReset(idlevelcid)
{
    if(!
cmd_access(idlevelcid1) )
        return 
PLUGIN_HANDLED;
    
    if(
file_exists(entsFile) )
    {
        
delete_file(entsFile);
        
client_print(idprint_console"Archivo removido");
    }
    
    return 
PLUGIN_HANDLED;
}

public 
HookCmdRemove(idlevelcid)
{
    if(!
cmd_access(idlevelcid1) )
        return 
PLUGIN_HANDLED;
    
    
EntCount(id);
    return 
PLUGIN_HANDLED;
}

/*stock */EntCount(id)
{
    new 
Float:fOrigin[3];
    
entity_get_vector(idEV_VEC_originfOrigin);
    
    new 
Menu menu_create("\ySe encontraron las siguientes entidades:""MenuEntDeleteHandler"0);
    
    new 
iEntszNum[5], szClassname[32];
    new 
iNumweap;
    while(
iEnt find_ent_in_sphere(iEntfOriginRADIO) )
    {
        
/*if(iNum == MAX_ENTS)
        break;*/
        
        
entity_get_string(iEntEV_SZ_classnameszClassname31);
        
        
weap find_ent_by_owner(-1szClassnameid);
        
        if(
iEnt == id || iEnt == weap) continue;
        if(
contain(szClassname"info_player_") != -1) continue;
        
        
iNum++;
        
num_to_str(iNumszNum4);
        
        
SetRendering(iEntkRenderFxNone25500kRenderTransColor255);
        
menu_additem(MenuszClassnameszNum0);
        
        
entTarget[id][iNum-1] = iEnt // i am not sure, but i think this method is a crap, or not?
    
}
    
    if(
iNum 0)
    {
        
menu_display(idMenu);
    }
    else
    
client_print(idprint_chat"No se encontro ninguna entidad alrededor");
}

public 
MenuEntDeleteHandler(idMenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(Menuitemaccessdata5iName63callback);
    
    new 
iEnt entTarget[id][item];
    
    if(!
is_valid_ent(iEnt) )
        return 
PLUGIN_HANDLED;
    
    
SaveEntity(iEntiName);
    
remove_entity(iEnt);
    
    
//menu_destroy(Menu);
    
return PLUGIN_HANDLED;
}

SaveEntity(iEnt, const Classname[])
{    
    new 
szModel[32], szData[84];
    new 
fopen(entsFile"at");
    
    
entity_get_string(iEntEV_SZ_modelszModel31);
    
    
formatex(szData83"%s %s^n"ClassnameszModel);
    
fputs(fszData);
    
    
fclose(f);
}

LoadEntsRemoved()
{
    if(!
file_exists(entsFile) )
        return 
0;
    
    new 
szData[84], szClass[32], szModel[48];
    
//new entModel[48], entClass[32];
    
new fopen(entsFile"rt");
    
    while(!
feof(f) )
    {
        
//log_amx("que ondis");
        
        
fgets(fszData83);
        
parse(szDataszClass31szModel47);
        
        
ArrayPushString(gClassszClass);
        
ArrayPushString(gModelszModel);
        
        
TotalEnts++
        
        
/*entity_get_string(ent, EV_SZ_model, entModel, 47);
        entity_get_string(ent, EV_SZ_classname, entClass, 31);
        
        if(equal(entClass, szClass) && equal(entModel, szModel) )
            remove_entity(ent);*/
    
}
    
    
fclose(f);
    
    return 
1;
}

stock SetRendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16
{
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);
    
    
entity_set_int(entityEV_INT_renderfxfx);
    
entity_set_vector(entityEV_VEC_rendercolorRenderColor);
    
entity_set_int(entityEV_INT_rendermoderender);
    
entity_set_float(entityEV_FL_renderamtfloat(amount) );
    
    return 
1;

__________________
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^
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 09-29-2010 , 14:10   Re: [ES] Algun tutorial de arrays?
#6

Fijate lo acabé de hacer ^^

Poné /vida y te carga lo que tengas en el archivo Vida.ini

Y acá tenés el minitutorial de arrays dinámicas by speed.

Click me
Attached Files
File Type: sma Get Plugin or Get Source (TestArrays.sma - 710 views - 2.1 KB)
File Type: ini Vida.ini (3 Bytes, 213 views)
__________________
Reality is wrong, dreams are for real.

Last edited by g_often; 09-29-2010 at 14:13.
g_often is offline
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 09-29-2010 , 14:47   Re: [ES] Algun tutorial de arrays?
#7

Quote:
Originally Posted by g_often View Post
Fijate lo acabé de hacer ^^

Poné /vida y te carga lo que tengas en el archivo Vida.ini

Y acá tenés el minitutorial de arrays dinámicas by speed.

Click me
claro, el tema de numeros en arrays, ya l ose manejar, se me complica con los strings.
Raddish is offline
Old 09-29-2010, 15:30
EnterPrice62
This message has been deleted by EnterPrice62. Reason: me confundí de thread
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 09-29-2010 , 15:34   Re: [ES] Algun tutorial de arrays?
#8

Quote:
Originally Posted by Raddish View Post
claro, el tema de numeros en arrays, ya l ose manejar, se me complica con los strings.
No hay "tanta" diferencia que digamos, mirá...
Attached Files
File Type: sma Get Plugin or Get Source (TestArrays.sma - 675 views - 1.3 KB)
File Type: ini Strings.ini (24 Bytes, 199 views)
__________________
Reality is wrong, dreams are for real.
g_often is offline
shinoda
Spanish Moderator
Join Date: Nov 2009
Location: ag_crossfire
Old 09-29-2010 , 16:33   Re: [ES] Algun tutorial de arrays?
#9

Otro ejemplo:
PHP Code:
#include <amxmodx>

new Array:MyArray
new iMaxplayers

public plugin_init() {
    
register_clcmd("say save""cmdSave")
    
register_clcmd("say test""cmdTest")
    
    
iMaxplayers get_maxplayers()
    
MyArray ArrayCreate(32iMaxplayers)
}

public 
cmdSave(id) {
    new 
szName[32]
    
    for(new 
iClient=1iClient<=iMaxplayers; ++iClient) {
        if(!
is_user_connected(iClient))
            continue
            
        
get_user_name(iClientszNamesizeof(szName)-1)
        
ArrayPushString(MyArrayszName)
    }
    
    return 
1
}

public 
cmdTest(id) {
    new 
iSize ArraySize(MyArray)
    new 
szOutput[32]
    for(new 
ii<iSize; ++i) {
        
ArrayGetString(MyArrayiszOutputsizeof(szOutput)-1)
        
log_amx(szOutput)
    }
    
    return 
1
}

public 
plugin_end()
    
ArrayDestroy(MyArray
__________________
Oh hell no this shit is awesome !!!

Last edited by shinoda; 10-11-2010 at 12:39.
shinoda is offline
Send a message via MSN to shinoda Send a message via Skype™ to shinoda
Kiske
Veteran Member
Join Date: May 2009
Old 09-29-2010 , 18:23   Re: [ES] Algun tutorial de arrays?
#10

http://forums.alliedmods.net/showthread.php?t=115831
__________________

Kiske is offline
Send a message via Skype™ to Kiske
Old 09-29-2010, 18:25
GOLGOLGOLGOL
This message has been deleted by Alucard^.
 



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:41.


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