PDA

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



bossxxl
9th April 2015, 00:00
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



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






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[i] thread warn(self.name);
if(!players[i] meleebuttonpressed()) continue;
players[i] notify("endwarn");
if(!players[i].lang) players[i] setclientcvar("ui_text",self.name+" ^2Reviving ^7..."); else players[i] setclientcvar("ui_text","^2Reviving ^7"+self.name+"^2...");
time=1;
if(isdefined(level.diff)) switch(level.diff)
{
case 1: time=4;break;
case 2: time=5;break;
case 3: time=6;break;
case 4: time=8;break;
case 5: time=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.x = 320;
players[i].progressbackground.y = 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.x = 256;
players[i].progressbar.y = 340;
players[i].progressbar.color = (0,1,0);
players[i].progressbar setShader("white", 0, 8);
players[i].progressbar scaleOverTime(time, 128, 8);

players[i] disableWeapon();
players[i] linkto(getentarray("node","targetname")[0]);

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

if(progresstime >= time)
{
players[i] setclientcvar("ui_text","");
self.headstone delete();
players[i].progressbackground destroy();
players[i].progressbar destroy();
players[i] enableWeapon();
players[i] unlink();
if(!level.waiting && gettime()-self.spawntime>30000) players[i] thread 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.lang) self iprintlnbold(&"TOBBY_REVIVED"); else self iprintlnbold(&"TOBBYE_REVIVED");
self spawnplayer(o);
return;
}
players[i] setclientcvar("ui_text","");
if(isdefined(players[i].progressbackground)) players[i].progressbackground destroy();
if(isdefined(players[i].progressbar)) players[i].progressbar destroy();
players[i] enableWeapon();
players[i] unlink();
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


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


the code inside the function




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.lang) user 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 ^^

Mitch
9th April 2015, 06:47
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.lang) user iprintln(&"TOBBYE_BUY_AMMOGET");
wait 1.5;
}
}

bossxxl
9th April 2015, 11:28
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.lang) user iprintln(&"TOBBYE_BUY_AMMOGET");
wait 1.5;
}
}

Mitch
9th April 2015, 12:00
The code still does exactly the same as before your modifications.



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

if(a == c) // go to next loop (back to START)
continue;

if(a == b)
{
// do when a == b
}
}
}

bossxxl
9th April 2015, 12:38
if(user.pers["team"] == "axis")////// like this the check work?
{
///i can put nothing inside the script? i don't write anything
}

bossxxl
10th April 2015, 00:26
i do it but still doesn't work i can buy axis and allies

bossxxl
10th April 2015, 00:29
guys i try all ur suggestion but the smooke still doesnt come out so now im gonna try another stuff i found it


level._effect["american_smoke_grenade"] = loadfx ("fx/props/american_smoke_grenade.efx")

IzNoGoD
10th April 2015, 00:35
Did you try in developer mode?

bossxxl
10th April 2015, 11:18
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
if
(self.pers["team"] == "axis") didnt work do u know bzmod?