Lossy

Users
  • Content Count

    205
  • Donations

    0.00 EUR 
  • Joined

  • Last visited

Posts posted by Lossy


  1. Self = player entity by default in CoD4.

    Self waittill will happen when a player activates event, level is when anything activates the event i believe as it's a global trigger.

    The endon there so the script stops looping. If a script continues to loop when a player not there it willl give of errors such as "undefined" which means it can't find who "self" is in this case because he has left. So yes this will end the script when player disconnects if the code has been activated.

    It also helps you end scripts on certain events e.g if you have something following a player but you don't want it to follow him when he dies or join spectators you'd add endon ("death"); or endon ("joined_spectators"); or you can do both to be sure. You can find these events like "death", "disconnect", "spawned" etc.. in the mod.ff or for stock cod4 you'd find them in the globallogic.gsc.

    More info: http://wiki.modsrepository.com/index.php?title=Notify_/_Endon_/_Waittill

    If you want to get into a read coding language GSC isn't really the best option since it's more of a game script language not a proper language like python, java, C/C++ etc..


  2. Where is level.player defined? the reason krazi script didn't work is because he had ! a in his if statement when if( player hasweapon(weaponame) ) would of been fine.

    Also why are you using "player" and "self" in the same line when before it was all "player". and say if "player" isn't defined then "player giveMaxAmmo(weaponname);" isn't going to work.

    Also if you want to detect when a player respawns in deathrun you can do waittill( "spawned_player" );

    e.g


    detectWeapon()
    {
    self endon("disconnect");
    for(;
    {

    self waitTill("spawned_player");

    if( self hasWeapon("weaponame_mp") )
    {
    self takeAllWeapons();
    self giveWeapon("weaponname_mp");
    self giveMaxAmmo("weaponname_mp");
    self switchtoweapon("weaponname_mp");
    }
    }
    }