how to call a value from another function?
for exmple i have test()
and i wanna call from it a value 'slot' for example is it possible?
Printable View
how to call a value from another function?
for exmple i have test()
and i wanna call from it a value 'slot' for example is it possible?
Not sure what you mean with your question. Here's a few examples:
PHP Code:
foo()
{
a = bar();
iprintlnbold(a);
}
bar()
{
return "hello world";
}
PHP Code:
foo()
{
iprintlnbold(bar());
}
bar()
{
return "hello world";
}
PHP Code:
foo()
{
a = bar("world");
iprintlnbold(a);
}
bar(asdf)
{
return "hello " + asdf;
}
PHP Code:
foo()
{
iprintlnbold(bar("hello", "world"));
}
bar(asdf, jkl)
{
return asdf + " " + jkl;
}
All these functions result in an iprintlnbold("hello world");
test() call slot;
or did you mean:
PHP Code:
test()
{
// self is whatever the function called, for example player
if( isDefined( self ) )
{ /* do something */ }
}
player test();
i wanna call slot not the function the slot inside the function
Callback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime)
like if (swepon ==slot)
do some shit
test()
{
self endon("disconnect");
self notify("start_sprinting");
sprint_weap="iwx_sprint_mp";
slot="";
{
i still have no idea what you're trying to do. Explain better.
Use code tags.
Learn how to report on forums
Learn some english.
do you see the slot=""; inside the test funtion i wanna call it in another function
This visible within a given function
Use level or self or return;
return slot;
Code:test()
{
//... use if()
slot="kot";
//... use if()
slot="pog";
//... use if()
slot="";
//...
return slot;
}
Code:CodeCallback_PlayerCommand(args)
{
self endon("disconnect");
//...
if(args[0]=="test")
{
iprintlnbold(test());//output: kot |or| pog |or| "" - using if()
return;
}
//...
}
i dont mean this
i mean this
CodeCallback_PlayerCommand(args)
{
self endon("disconnect");
bingband=slot; /// how to call this slot from another function
}
test()
{
slot=3;/// i want to call the 3 to the other function how ?
}
CodeCallback_PlayerCommand(args)
{
self endon("disconnect");
bingband=test();
}
test()
{
slot=3;
return slot;
}
test()
{
bosswp(slot)=3; // i want the 3 go to the bosswp function how to write that? is my writing correct?
return slot;
}
bosswp(slot)
{
slotboss=slot;
return slot;
}