Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why is this not working?
#1
at the weaponthink .. self.lastplayer contains the name of the player who took the gun from that spawn the last time, but its not saving the name Sad

Code:
CreateWeapon(weapon, weaponName, location, angle)
{
    weaponModel = getWeaponModel( weapon );

    if( weaponModel == "" )
        weaponModel = weapon;

    if(!isDefined(angle))
        angle = 0;

    weaponSpawn = spawn( "script_model", location + (0, 0, 35), 1 );
    weaponSpawn setModel( weaponModel );
    weaponSpawn.angles = angle;
    weaponSpawn thread WeaponThink( weapon, weaponName, location, angle );
    weaponSpawn thread spinPickup( weaponSpawn );
    weaponSpawn thread pickupFX( weaponSpawn, location, level.groundfxgreen );
    wait 0.01;
}

WeaponThink(weapon, weaponName, location, angle)
{
    self endon("disconnect");
    weptrigger = spawn( "trigger_radius", location, 0, 35, 50 );
    while(1)
    {
        weptrigger waittill( "trigger", player );
        if(!isDefined(self.lastPlayer))
        {
            self.lastPlayer = "nobody";
        }
        
        if(level.campprotect == 1 && self.lastPlayer == player.name)
        {
            player iprintlnbold( "Stop camping at the " + weaponName + " spawn." );
            warningsleft = 3 - player.warning;
            player iprintlnbold( "You've got " + warningsleft + " warnings left till suicide." );
            player.warning++;
            if(player.warning == 3)
            {
                player suicide();
            }
        }
        if(distance(location, player.origin) < 50)
        {
            lastPlayer = player.name;
            player.hint = "Press ^3[{+activate}] ^7to pick up " + weaponName;
            if(player useButtonPressed())
            {
                player takeWeapon(player getCurrentWeapon());
                player _giveWeapon( weapon );
                player switchToWeapon( weapon );
                
                self delete();
                weptrigger delete();

                level thread weaponRespawnThink(weapon, weaponName, location, angle);
            }
        }
        wait .05;
    }
}

weaponRespawnThink(weapon, weaponName, location, angle)
{
    unavailable = spawn( "script_origin", location, 1 );
    unavailable thread pickupFX( unavailable, location, level.groundfxred );
    wait 15;
    unavailable delete();
    createWeapon(weapon, weaponName, location, angle);
}
(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

#2

lastPlayer = player.name;

instead of self.lastPlayer =
Reply

#3
Thanks! Big Grin+
Now its killing me always XD

i added a wait 5; but now i cannot pick up the weapon even if i'm not the one who picked it up last Tongue

Code:
WeaponThink(weapon, weaponName, location, angle)
{
    self endon("disconnect");
    weptrigger = spawn( "trigger_radius", location, 0, 35, 50 );
    while(1)
    {
        weptrigger waittill( "trigger", player );
        if(!isDefined(self.lastPlayer))
        {
            self.lastPlayer = "";
        }
        
        if(level.campprotect == 1 && self.lastPlayer == player.name)
        {
            player iprintlnbold( "Stop camping at the " + weaponName + " spawn." );
            warningsleft = 3 - player.warning;
            player iprintlnbold( "You've got " + warningsleft + " warnings left till suicide." );
            player.warning++;
            if(player.warning == 3)
            {
                player suicide();
            }
            wait 5;
        }
        if(distance(location, player.origin) < 50)
        {
            self.lastPlayer = player.name;
            player.hint = "Press ^3[{+activate}] ^7to pick up " + weaponName;
            if(player useButtonPressed())
            {
                player takeWeapon(player getCurrentWeapon());
                player _giveWeapon( weapon );
                player switchToWeapon( weapon );
                
                self delete();
                weptrigger delete();

                level thread weaponRespawnThink(weapon, weaponName, location, angle);
            }
        }
        wait .05;
    }
}
(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
Code:
WeaponThink(weapon, weaponName, location, angle, lastPlayer)
{
    self endon("disconnect");
    weptrigger = spawn( "trigger_radius", location, 0, 35, 50 );
    while(1)
    {
        weptrigger waittill( "trigger", player );

        if(level.campprotect == 1 && lastPlayer == player && isDefined(lastPlayer))
        {
            player iprintlnbold( "Stop camping at the " + weaponName + " spawn." );
            warningsleft = 3 - player.warning;
            player iprintlnbold( "You've got " + warningsleft + " warnings left till suicide." );
            player.warning++;
            if(player.warning == 3)
            {
                player suicide();
            }
            wait 5;
        }
        if(distance(location, player.origin) < 50)
        {
            player.hint = "Press ^3[{+activate}] ^7to pick up " + weaponName;
            if(player useButtonPressed())
            {
                player takeWeapon(player getCurrentWeapon());
                player _giveWeapon( weapon );
                player switchToWeapon( weapon );
                
                self delete();
                weptrigger delete();

                level thread weaponRespawnThink(weapon, weaponName, location, angle, player);
            }
        }
        wait .05;
    }
}

weaponRespawnThink(weapon, weaponName, location, angle, lastPlayer)
{
    unavailable = spawn( "script_origin", location, 1 );
    unavailable thread pickupFX( unavailable, location, level.groundfxred );
    wait 15;
    unavailable delete();
    createWeapon(weapon, weaponName, location, angle, lastPlayer);
}

CreateWeapon(weapon, weaponName, location, angle, lastPlayer)
{
    weaponModel = getWeaponModel( weapon );

    if( weaponModel == "" )
        weaponModel = weapon;

    if(!isDefined(angle))
        angle = 0;

    weaponSpawn = spawn( "script_model", location + (0, 0, 35), 1 );
    weaponSpawn setModel( weaponModel );
    weaponSpawn.angles = angle;
    weaponSpawn thread WeaponThink( weapon, weaponName, location, angle, lastPlayer );
    weaponSpawn thread spinPickup( weaponSpawn );
    weaponSpawn thread pickupFX( weaponSpawn, location, level.groundfxgreen );
    wait 0.01;
}

?
helped ya? rep me +
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Plugins are not working clemi555 7 4,832 11-03-2013, 10:55
Last Post: d0h!
  [Release] Working Aimbot The Clay Man 17 20,376 10-21-2013, 15:10
Last Post: zurasaur
  How to get models working? Erik The Born 2 3,057 04-28-2013, 08:19
Last Post: Erik The Born
  [d3d9.dll] MW3 Server Has Stopped Working.. bertancakici 4 6,506 11-16-2012, 01:09
Last Post: JariZ
Sad Help KillifBelow Not Working DidUknowiPwn 4 3,186 10-29-2012, 10:22
Last Post: RaZ
  the big show-what-you're-working-on thread JariZ 183 77,262 09-07-2012, 21:32
Last Post: Nekochan
  server stop working s.j-rez 9 5,244 08-26-2012, 06:23
Last Post: s.j-rez
  stop working eror{please help me:((} s.j-rez 0 1,919 08-25-2012, 12:47
Last Post: s.j-rez
Question Help what dvars can be used and working, in forceclientdvars? founderlj 1 2,253 08-20-2012, 08:21
Last Post: d0h!
Rainbow [TIP] How to get maps working. Nekochan 6 4,517 06-26-2012, 11:31
Last Post: JariZ

Forum Jump:


Users browsing this thread:
1 Guest(s)

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