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

Inc


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 11-24-2010 , 10:34   Inc
Reply With Quote #1

PHP Code:
new TeamAScore[3];
new 
TeamBScore[3];
new 
TeamAHalfA[3];
new 
TeamAHalfB[3];
new 
TeamBHalfA[3];
new 
TeamBHalfB[3];

public 
asd() {
[
95]      TeamBScore += 1;
[
94]      TeamBHalfA += 1;
            return 
PLUGIN_HANDLED
}
public 
asd2() {
[
114]     TeamBScore ++;
[
115]     TeamBHalfA ++;
            return 
PLUGIN_HANDLED

Quote:
Error: Array assignment must be simple assignment on line 95
Warning: Expression has no effect on line 95
Error: Array assignment must be simple assignment on line 96
Warning: Expression has no effect on line 96
Error: Must be lvalue (non-constant) on line 114
Error: Must be lvalue (non-constant) on line 115
I Can do it with other way but i don't remember how i have forgot
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
shadow.hk
Senior Member
Join Date: Dec 2008
Location: WA, Australia
Old 11-24-2010 , 13:43   Re: Inc
Reply With Quote #2

PHP Code:
public asdnum )
{
     for( new 
03i++ )
     {
          
TeamBScore] += num;
          
TeamBHalfA] += num;
     }

?
shadow.hk is offline
Send a message via MSN to shadow.hk
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 11-24-2010 , 15:05   Re: Inc
Reply With Quote #3

:/
actually i want The Variable to be just one value... :/
a team score
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2010 , 16:08   Re: Inc
Reply With Quote #4

Quote:
Originally Posted by ProIcons View Post
:/
actually i want The Variable to be just one value... :/
a team score
Then why did you make arrays?

Quote:
Originally Posted by ProIcons View Post
PHP Code:
new TeamAScore[3];
new 
TeamBScore[3]; 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 11-24-2010 , 16:20   Re: Inc
Reply With Quote #5

well after posting this post, i was wondering the same thing xD. if i will do it index variable, i will be able to set it like this:

var = 1;
var = "asd";
var ++;
etc ?
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2010 , 16:36   Re: Inc
Reply With Quote #6

You can only set an array to another array of equal or lesser size.
You can't mix dimensions.

Code:
new var; // 0 dimensions new var2[10]; // 1 dimension new var3[10][10]; // 2 dimensions // etc. var = var2; // invalid (var=0dim, var2=1dim) var = var3; // invalid (var=0dim, var3=2dim) var2 = var; // invalid (var2=1dim, var=0dim) var2 = var3; // invalid (var2=1dim, var3=2dim) var3 = var; // invalid (var3=2dim, var=0dim) var3 = var2; // invalid (var3=2dim, var2=1dim)

When you index an array, you remove 1 dimension.

Code:
var = var2[0]; // valid (var=0dim, var2[0]=0dim) var = var3[0][0]; // valid (var=0dim, var3[0][0]=0dim) var2[0] = var; // valid (var2[0]=0dim, var=0dim) var2 = var3[0]; // valid (var2=1dim, var3[0]=1dim) var2[0] = var3[0][0]; // valid (var2[0]=0dim, var3[0][0]=0dim) var3[0] = var2; // valid (var3[0]=1dim, var2=1dim) var3[0][0] = var; // valid (var3[0][0]=0dim, var=0dim) var3[0][0] = var2[0]; // valid (var3[0][0]=0dim, var2[0]=0dim)

Examples:
Code:
new iPlayers[32]; // iPlayers is 1dim array //get_players()... new iPlayer = iPlayers[0]; // iPlayer is 0dim variable, iPlayers[0] gets a 0dim variable because it removes 1 dimension.
Code:
new szNames[33][32]; // array of all player name arrays = 2dim new szName[32]; // player name array = 1dim szName = szNames[0]; // szName=1dim, szNames[0]=1dim because it is indexes so 1 dimension is removed
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 11-24-2010 , 16:57   Re: Inc
Reply With Quote #7

how can i add a value to an index var..? format(TeamBScore,2,"asd"); ? Something like this..
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-24-2010 , 17:01   Re: Inc
Reply With Quote #8

You can't mix integers and strings.
What are you trying to do?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 11-25-2010 , 03:01   Re: Inc
Reply With Quote #9

Actually i am trying to
set a team score example:

TeamAScore = 0;

TO reset it. and after that every round end to Inc it... but after that i want to check somehow this values

Example
PHP Code:
if (equali(TeamBScore,"16")) {
            
msg("Match is Finished. Team Beta Won");
        }
        if (
equali(TeamAScore,"16")) {
            
msg("Match is Finished. Team Alpha Won");
        }
if( (
equali(TeamBScore,"15")) && (equali(TeamAScore,"15")) {
            
msg("Match is Finished. Team Are Draw");
        } 
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-25-2010 , 03:55   Re: Inc
Reply With Quote #10

Code:
if(TeamAScore == 16)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
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 03:08.


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