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?
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");
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
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();
Last edited by serthy; 23rd July 2016 at 11:46.
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="";
{
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; } //... }
Last edited by Paho; 23rd July 2016 at 13:25.
maxdamage99 (23rd July 2016)
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.
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
thats the sprint function
do you see the slot=""; inside the test funtion i wanna call it in another function
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 ?
}