Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help self in my own gsc ?!? - SOLVED
#1
How can i Use the variable "self" in my own .gsc file?

secound:
for what are Arguments, what can i do with them, how can i define them and how can i use them?

execute command:
PHP Code:
self thread maps\mp\gametypes\myfile::myfunktionARGUMENTS ); 
myfile.gsc:
PHP Code:
myfunktionARGUMENTS )
{


Hope, you can help me... Wink
Sorry for bad English Blush -> *GERMAN*
Reply

#2
dont use php tags, use [ code] instead

yeah, you can use self but you need to add #include from file like _rank. (if this is what you meant, explain what do you mean by that )

to use variables, do it like that
Code:
giveweapon(weapon)
{
self giveweapon(weapon);
}
and call it like this
Code:
self thread giveweapon(onemanarmy_mp);

thats all, OMA
[Image: lQDUjba.jpg]
Reply

#3
If you use

Code:
self thread blabla::function()
then "self" will be "self" in your function aswell (I hope you understand)

for example in some files you will find this:
Code:
onPlayerConnected()
{
    while( true )
    {
        level waittill( "connecting", player );
        player thread onPlayerSpawned();
    }
}

onPlayerSpawned()
{
    self endon( "disconnect" );
    for( ;; )
    {
        self waittill( "spawned_player" );
    }
}

the "player" in onPlayerConnected is obviously a player and "onPlayerSpawned" is called from the player so the variable "self" in onPlayerSpawned is that player. Now if I call a function after the player spawned:
Code:
self waittill( "spawned_player" );
self doMyFunction();
then in "doMyFunction" the variable "self" will be the same player as the player in "onPlayerSpawned" and "onPlayerConnect"
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#4
(11-02-2011, 16:35)OrangePL Wrote:

(11-02-2011, 16:37)iAegle Wrote:

I have understand the first question but i have still 2 questions:
if i use:
Code:
other_player thread mapsmpgametypesmyfile::myfunktion( ARGUMENTS );
to execute the funktion, can i use "self" in the funktion "myfunktion" to give something the player "other_player" ?

secound:
If i will execute a funktion like:
Code:
if( level.variableone == 1 && self.variabletwo > 2 && variable3 != "tdm" )
{self thread mapsmpgametypesmyfile::myfunktion();}
How can i edit the secound line, so that i can use "level.variableone", "self.variabletwo" and "variable3" in "myfunktion"?

Thx for Answers Smile
Sorry for bad English Blush -> *GERMAN*
Reply

#5
Inside a function, 'self' refers to the entity that the function was called on.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help [C#] WebClient how to know real url [solved] narkos 21 11,851 09-09-2013, 15:21
Last Post: surtek
Information Help How to edit new derived entry? (Solved) SSonic70 1 2,474 08-20-2013, 15:29
Last Post: Nekochan
  Help [solved]red hitmark mod? founderlj 7 4,208 12-30-2012, 23:06
Last Post: Pozzuh
  !weapon Plugin help pls [solved] Hallla 0 1,844 12-30-2012, 14:04
Last Post: Hallla
  Help !giveammo Plugin doesnt work [solved] Hallla 3 3,260 12-29-2012, 20:53
Last Post: Hallla
  Help OnPlayerConnect [Solved] 99IRock 4 3,863 11-18-2012, 10:07
Last Post: 99IRock
  Give Gun Error [SOLVED] koro35 4 3,613 11-17-2012, 15:15
Last Post: koro35
  Help Mw3 server error 2 [Solved] 99IRock 6 22,037 11-17-2012, 12:38
Last Post: 99IRock
  Help Mw3 server Error [Solved] 99IRock 3 4,168 11-16-2012, 07:38
Last Post: 99IRock
Information [Solved] Info about functions, events and etc. Nerus 2 2,309 09-09-2012, 20:57
Last Post: surtek

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.