SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   Little coding questions - For general minor queries 5 (https://forum.sa-mp.com/showthread.php?t=30938)

ConTron 23/03/2008 10:11 AM

Re: Little coding questions - For general minor queries 5
 
Quote:

Originally Posted by mabako
[SCF]ConTron:

if it doesn't show the SendClientMessage, you're doing something wrong somewhere else. Plus you don't need HideMenu in the callback for when a row was selected. (however it may be called)

I dont get it though, i copied it from a working bit of the menu. I just dont know why it dosent teleport me :(

Redirect Left 24/03/2008 02:05 AM

Re: Little coding questions - For general minor queries 5
 
Are there any known limits on how many people can be banned? I mean, surely eventually the samp ban file will become so big it'll be hard to read, and slow down stuff, yes/no?

(Sorry, I'm just trying to debug my servers instability and my SSH reporting weird errors)

!damo!spiderman 24/03/2008 05:03 AM

Re: Little coding questions - For general minor queries 5
 
We were just discussing this actually... a ban file of over 1000 you'll see a considerable amount of increase in cpu usage. For larger servers we'd probably suggest using a sqllite database to check for bans. Or just clear you ban file every couple of months

Dabombber 25/03/2008 01:27 AM

Re: Little coding questions - For general minor queries 5
 
For strings in enumerations, something like

Code:

enum e_test { bla[50] }
new test[e_test];
printf("sizeof bla = %i", sizeof(test[bla]));

works fine, but how would you get the size from a multidimensional array like

Code:

new test[10][e_test]

yom 25/03/2008 02:08 AM

Re: Little coding questions - For general minor queries 5
 
Edit: sorry misread.

!damo!spiderman 25/03/2008 06:40 AM

Re: Little coding questions - For general minor queries 5
 
pawn Code:
sizeof( test[0][bla] );
Replace 0 with whatever cell you want to check

Dabombber 25/03/2008 07:28 AM

Re: Little coding questions - For general minor queries 5
 
Code:

enum e_test { bla[50] }
new test[10][e_test];
printf("sizeof bla = %i", sizeof(test[0][bla]));

doesn't even compile

homie.pl 25/03/2008 02:39 PM

Re: Little coding questions - For general minor queries 5
 
Try
Code:

enum e_test { bla[50] }
new test[10][e_test];
printf("sizeof bla = %i", strlen(test[0][bla]));

I've got also question about multidimensional array but with enumeration. When I create for example array:
Code:

new ObjectInfo[200][oInfo];
that has enumeration:
Code:

enum oInfo
{
        realid[MAX_PLAYERS],
        modelid,
        Float:x,
        Float:y,
        Float:z,
        Float:rx,
        Float:ry,
        Float:rz,
        bool:isset[MAX_PLAYERS]
}

then I put numbers in and I print the modelid of first 8 dimensions from array
Code:

[15:57] 615
[15:57] 615
[15:57] 615
[15:57] 3249
[15:57] 3241
[15:57] 744
[15:57] 744
[15:57] 744

This is what I need. Everything is proper. But when I change

Code:

new ObjectInfo[200][oInfo];
to
Code:

new ObjectInfo[][oInfo];
I get printed
Code:

[15:58] 0
[15:58] 579
[15:58] 615
[15:58] 0
[15:58] 3241
[15:58] 744
[15:58] 744
[15:58] 744

As you can see few numbers are printed correctly, but rest not.

And here's my question, why does it happen. And I cannot use number to set number of dimensions, because I'd have to use 5000 which makes my script almost 2MB large.

homie.pl 25/03/2008 07:10 PM

Re: Little coding questions - For general minor queries 5
 
Ok but when I set number of dimensions I get 2MB amx... Is there any way to reduce this size?

Backwardsman97 28/03/2008 01:37 AM

Re: Little coding questions - For general minor queries 5
 
Did they clean up this topic?


All times are GMT. The time now is 07:02 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.