AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Filling a double dimensional array (https://forums.alliedmods.net/showthread.php?t=298810)

Depresie 06-23-2017 09:29

Filling a double dimensional array
 
What is wrong in this ?

PHP Code:

new Float:gf_PlayerDamage[33][31] = { 1.0, .. } 


Craxor 06-23-2017 09:44

Re: Filling a double dimensional array
 
I don't know, what is wrong ? you have anny error ?

Depresie 06-23-2017 09:45

Re: Filling a double dimensional array
 
"invalid expression, assumed zero"

Craxor 06-23-2017 09:50

Re: Filling a double dimensional array
 
can you post the whole code please ?

PRoSToTeM@ 06-23-2017 09:52

Re: Filling a double dimensional array
 
Better to initialize it for player in client_connect or client_putinserver.

Craxor 06-23-2017 09:59

Re: Filling a double dimensional array
 
yes, as pro said, this is the only way that have been working to compile after some sort tests, if i find another method i will post.
PHP Code:

#include <amxmodx>

new Float:gf_PlayerDamage[33][31];

public 
client_putinserver(id)
{
    
gf_PlayerDamage[id][id] = 1.0;



Depresie 06-23-2017 10:11

Re: Filling a double dimensional array
 
Well, i really want no to do it on client connect, that's why i came here..

Craxor 06-23-2017 10:14

Re: Filling a double dimensional array
 
Lol, everybody try to compile this plugin and print the output errors:
PHP Code:

#include <amxmodx>

enum MyData
{
       
Float:Float1[33] = 1.0,
       
Float2[33] = 1.0
};

new const 
PD[MyData];

public 
client_putinserver(id)
{
    
// just a test...
    
PD[Float1[id]] = 30.0;
    
PD[Float2[id]] = 40.0;



PRoSToTeM@ 06-23-2017 11:39

Re: Filling a double dimensional array
 
Quote:

Originally Posted by Depresie (Post 2530992)
Well, i really want no to do it on client connect, that's why i came here..

And how you reset it for next connected player? (old one player was disconnected, and new one connected got slot of old player)

eyal282 06-23-2017 16:09

Re: Filling a double dimensional array
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2531029)
And how you reset it for next connected player? (old one player was disconnected, and new one connected got slot of old player)

I'm quite sure it's handled automatically.


All times are GMT -4. The time now is 23:11.

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