Raised This Month: $ Target: $400
 0% 

Dynamic Arrays Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 08-10-2012 , 11:47   Dynamic Arrays Problem
Reply With Quote #1

Hi

I have next problem. I wont check what do dynamic arrays. I writed this plugin:
Code:
#include <sourcemod>

public Plugin:myinfo = 
{
    name = "Pawemol test plugin",
    author = "Pawemol",
    description = "Plugin do różnych testów",
    version = "Beta",
    url = "minigun.pl"
}

public OnPluginStart()
{
    RegAdminCmd("dynamic_arrays_test", Testuj_Dynamiczne_Tabele, ADMFLAG_GENERIC, "Testuje dynamiczne tabele.");
}

public Action:Testuj_Dynamiczne_Tabele(client, args)
{
    new Handle:tabela = CreateArray(128, 1);
    PushArrayCell(tabela, 1);
    PushArrayString(tabela, "Tabela działa.");
    new String:Zdanie[64];
    GetArrayString(tabela, 1, Zdanie, 64)
    PrintToChat(client, "Wielkość tabeli: %i, Liczba: %i, Znaki: %s",    GetArraySize(tabela),GetArrayCell(tabela, 1), Zdanie);
    CloseHandle(tabela);
}
I think that my array has size 1. It has size 3. Why?
Next problem is that i can't get string. Can you help me?
Pawemol12 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-10-2012 , 11:52   Re: Dynamic Arrays Problem
Reply With Quote #2

You either use cells, strings or arrays. Don't mix them in a single Array.
hleV is offline
Pawemol12
Member
Join Date: Jun 2012
Location: Poland - Wojnowice
Old 08-10-2012 , 12:46   Re: Dynamic Arrays Problem
Reply With Quote #3

I have bad index. Now i check and i can mix strings and cails.
Pawemol12 is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 08-10-2012 , 13:06   Re: Dynamic Arrays Problem
Reply With Quote #4

PHP Code:
new Handle:tabela CreateArray(ByteCountToCells(128)); 
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
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 12:14.


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