AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Arguments question.. (https://forums.alliedmods.net/showthread.php?t=205381)

alonelive 01-10-2013 05:08

Arguments question..
 
Hello.
For example, a have this code:

public stage_a() {
new a, b, c
execfunc(a, b, c)
}

public stage_b() {
new a, b, D
execfunc(a, b, D)
}

Help me with true variant (code).. Using arguments: a, b, c OR D

public execfunc(a, b, c, D) {} - compile error
public execfunc(a, b, c:D) {} - compile warning
public execfunc(a, b, c or D) {} ?

AngeIII 01-10-2013 05:14

Re: Arguments question..
 
inside public execfunc(<<HERE>>);
it is local variables, and it doesn't matter what names of that.
PHP Code:

public stage_a() {
         new 
bla1bbrasplsr
         execfunc
(bla1bbrasplsr)
}

public 
stage_b() {
         new 
abc
         execfunc
(abc)
}

public 
execfunc(local1,local2,local3) {} 

also you dont send a variable by "name". program send a variable by link or by value

alonelive 01-10-2013 05:46

Re: Arguments question..
 
Thank you again :)

public asfd() {

new mapname[32]
get_mapname(mapname, 31)
new Float:OriginT[3];
new Float:OriginCT[3];

OriginT[0] = 40.0;
OriginT[1] = 2030.0;
OriginT[2] = 36.0;

OriginCT[0] = 37.0;
OriginCT[1] = 2042.5;
OriginCT[2] = 82.0;

set_maps(mapname, OriginCT, OriginT)
}


stock set_maps(local1[], local2[], local3[]) {
..asdf
}

I have a tag mismatch error in compiler logs on line " set_maps(mapname, OriginCT, OriginT) "

AngeIII 01-10-2013 06:49

Re: Arguments question..
 
try
stock set_maps(local1[],Float:local2[],Float:local3[])


All times are GMT -4. The time now is 13:47.

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