Results 1 to 9 of 9

Thread: bot zombie problem if if(self.pers["team"] == "axis") doesnt work good :'( :'(

  1. #1
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry bot zombie problem if if(self.pers["team"] == "axis") doesnt work good :'( :'(

    I just add in my bot-zombie axis(zombie player) that me or any player waiting spawn after couple minutes waiting
    and
    i wanted like he doesn't revive anybody when he kill that person from axis

    first bug - when the allies(hunters) kill the axis(zombie player) it should not be revived he can revive it ..
    second bug - allies can heal the damaged axis(zombie player)
    third bug - axis(zombie player) can buy perks and a random perk and that thing i dont wanted it


    The fixes i try to do it


    PHP Code:
    if(self.pers["team"] == "allies" && self.pers["team"] != "axis"self thread revive(o); 
    this one didnt work

    but i guess the problem from this script




    PHP Code:
    revive(o)
    {
        
    self endon("disconnect");
        
    self endon("spawned_player");    
        
    self endon("youaredead");
        for(;;)
        {
            
    players=getentarray("player","classname");
             
            for(
    i=0;i<players.size;i++) if(isalive(players[i]) && distancesquared(players[i].origin,o)<4900)
            {
                
                if(
    isdefined(players[i].progressbackground)) continue;
                
    players[ithread warn(self.name);
                if(!
    players[imeleebuttonpressed()) continue;
                
    players[inotify("endwarn");
                if(!
    players[i].langplayers[isetclientcvar("ui_text",self.name+" ^2Reviving ^7..."); else players[isetclientcvar("ui_text","^2Reviving ^7"+self.name+"^2...");
                
    time=1;
                if(
    isdefined(level.diff)) switch(level.diff)
                {
                    case 
    1time=4;break;
                    case 
    2time=5;break;
                    case 
    3time=6;break;
                    case 
    4time=8;break;
                    case 
    5time=10;break;
                }
                if(
    isdefined(players[i].quickrevive)) time=time/2;
                
    self.reviver=players[i];
                
    players[i].progressbackground newClientHudElem(players[i]);
                
    players[i].progressbackground.horzAlign "fullscreen";
                
    players[i].progressbackground.vertAlign "fullscreen";
                
    players[i].progressbackground.alignX "center";
                
    players[i].progressbackground.alignY "middle";
                
    players[i].progressbackground.320;
                
    players[i].progressbackground.340;
                
    players[i].progressbackground.alpha 0.5;
                
    players[i].progressbackground setShader("black", (128 4), 12);
                
                
    players[i].progressbar newClientHudElem(players[i]);
                
    players[i].progressbar.horzAlign "fullscreen";
                
    players[i].progressbar.vertAlign "fullscreen";
                
    players[i].progressbar.alignX "left";
                
    players[i].progressbar.alignY "middle";
                
    players[i].progressbar.256;
                
    players[i].progressbar.340;
                
    players[i].progressbar.color = (0,1,0); 
                
    players[i].progressbar setShader("white"08);
                
    players[i].progressbar scaleOverTime(time1288);

                
    players[idisableWeapon();
                
    players[ilinkto(getentarray("node","targetname")[0]);

                
    progresstime 0;
                while(
    isAlive(players[i]) && players[imeleeButtonPressed() && (progresstime time))
                {
                    
    progresstime += 0.05;
                    
    wait 0.05;
                }

                if(
    progresstime >= time)
                {
                    
    players[isetclientcvar("ui_text","");
                    
    self.headstone delete();
                    
    players[i].progressbackground destroy();
                    
    players[i].progressbar destroy();
                    
    players[ienableWeapon();
                    
    players[iunlink();
                    if(!
    level.waiting && gettime()-self.spawntime>30000players[ithread money(1010);
                    
    self notify("revived");
                    if(
    isdefined(self.body)) self.body delete();
                    
    self.reviver=undefined;
                    
    self.pers["team"] = "allies";
                    
    self.stat["revived"]++;
                    
    players[i].stat["revives"]++;
                    if(!
    self.langself iprintlnbold(&"TOBBY_REVIVED"); else self iprintlnbold(&"TOBBYE_REVIVED");
                    
    self spawnplayer(o);
                    return;
                }
                
    players[isetclientcvar("ui_text","");
                if(
    isdefined(players[i].progressbackground)) players[i].progressbackground destroy();
                if(
    isdefined(players[i].progressbar)) players[i].progressbar destroy();
                
    players[ienableWeapon();
                
    players[iunlink();
                
    self.reviver=undefined;
            }
            
    wait 0.2;
        }




    and i try like to doesnt make the axis cant buy an ammo box i try inside the function
    this code but it made all players cant buy

    PHP Code:
    if(self.pers["team"] == "axis") return; 

    the code inside the function


    PHP Code:
    ammobox()
    {
    if(
    self.pers["team"] == "axis") return;////////here :'( didnt make the buy works for axis or allies

        
    cost=300;
        
    self sethintstring(&"TOBBYE_BUY_AMMO",cost,&"TOBBYE_BUY_END");
        for(;;)
        {
            
    self waittill("trigger",user);
            if(
    user.money<cost)
            {
                if(!
    user.lang)  user iprintlnbold(&"TOBBYE_NOMONEY");
                continue;
            }
            
    user.stat["ammo"]++;
            
    user thread scripts\bzmod::money(cost*(-1));
            
    user setweaponslotammo("primary",999);
            
    user setweaponslotammo("primaryb",999);
            
    user setWeaponClipAmmo("frag_grenade_german_mp"7);
            if(!
    user.languser iprintln(&"TOBBYE_BUY_AMMOGET");
            
    wait 1.5;
        }


    anyway guys if one code worked i can fix the other bugs with same code please help thnx ^^

  2. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    PHP Code:
    ammobox() 

    if(
    self.pers["team"] == "axis") return; // self is not a player

        
    cost=300
        
    self sethintstring(&"TOBBYE_BUY_AMMO",cost,&"TOBBYE_BUY_END"); 
        for(;;) 
        { 
            
    self waittill("trigger",user); // the user/player is defined here
            // add your check here and do not use return (it kill the buy after an axis player uses it)
            
    if(user.money<cost
            { 
                if(!
    user.lang)  user iprintlnbold(&"TOBBYE_NOMONEY"); 
                continue; 
            } 
            
    user.stat["ammo"]++; 
            
    user thread scripts\bzmod::money(cost*(-1)); 
            
    user setweaponslotammo("primary",999); 
            
    user setweaponslotammo("primaryb",999); 
            
    user setWeaponClipAmmo("frag_grenade_german_mp"7); 
            if(!
    user.languser iprintln(&"TOBBYE_BUY_AMMOGET"); 
            
    wait 1.5
        } 


  3. #3
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    ammobox() 



        
    cost=300
        
    self sethintstring(&"TOBBYE_BUY_AMMO",cost,&"TOBBYE_BUY_END"); 
        for(;;) 
        { 
            
    self waittill("trigger",user); 
            if(
    user.pers["team"] == "axis")////// like this the check work?


    }  
            if(
    user.money<cost
            { 
                if(!
    user.lang)  user iprintlnbold(&"TOBBYE_NOMONEY"); 
                continue; 
            } 
            
    user.stat["ammo"]++; 
            
    user thread scripts\bzmod::money(cost*(-1)); 
            
    user setweaponslotammo("primary",999); 
            
    user setweaponslotammo("primaryb",999); 
            
    user setWeaponClipAmmo("frag_grenade_german_mp"7); 
            if(!
    user.languser iprintln(&"TOBBYE_BUY_AMMOGET"); 
            
    wait 1.5
        } 


  4. #4
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    The code still does exactly the same as before your modifications.

    PHP Code:
    myFunction()  
    {  
        for(;;)  
        {  
            
    self waittill("trigger",user); // START

            
    if(== c// go to next loop (back to START)
                
    continue;
            
            if(
    == b)
            {
                
    // do when a == b     
            
    }
        }


  5. #5
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    if(user.pers["team"] == "axis")////// like this the check work?

    ///i can put nothing inside the script? i don't write anything

    Last edited by Mitch; 9th April 2015 at 12:52. Reason: always add your code within code or php tags!

  6. #6
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i do it but still doesn't work i can buy axis and allies

  7. #7
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    guys i try all ur suggestion but the smooke still doesnt come out so now im gonna try another stuff i found it
    PHP Code:
    level._effect["american_smoke_grenade"]        = loadfx ("fx/props/american_smoke_grenade.efx"

  8. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Did you try in developer mode?
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  9. #9
    Private
    Join Date
    Jul 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes i try in developer mod but i have problem if im axis i don't wanna buy a weapon or something i try if and become all players cant buy
    PHP Code:
    if
    (
    self.pers["team"] == "axis"didnt work do u know bzmod
    Last edited by bossxxl; 10th April 2015 at 11:24.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •