Co zmienialem
new ilosc_apteczek_gracza[33];
new ilosc_rakiet_gracza[33];
new ilosc_ammo_gracza[33]; // dodalem
new Float:poprzednia_rakieta_gracza[33];
new ilosc_min_gracza[33];
new ilosc_dynamitow_gracza[33];
new ilosc_skokow_gracza[33];
--------------------------------------------------------------------------------------------------------------
register_think("Apteczka","ApteczkaThink");
register_think("Ammo","AmmoThink"); // dodalem
--------------------------------------------------------------------------------------------------------------
public UzyjPrzedmiotu(id)
{
if(informacje_przedmiotu_gracza[id][0] == 19 && informacje_przedmiotu_gracza[id][1]>0)
{
set_user_health(id, maksymalne_zdrowie_gracza[id]);
informacje_przedmiotu_gracza[id][1]--;
}
if(ilosc_apteczek_gracza[id]>0)
StworzApteczke(id);
if(ilosc_rakiet_gracza[id]>0)
StworzRakiete(id);
if(ilosc_min_gracza[id]>0)
PostawMine(id);
if(ilosc_dynamitow_gracza[id]>0)
PolozDynamit(id);
if(ilosc_ammo_gracza[id]>0) //dodalem
StworzAmmo(id); // dodalem
return PLUGIN_HANDLED;
}
--------------------------------------------------------------------------------------------------------------
public StworzAmmo(id)
{
if (!ilosc_ammo_gracza[id])
{
client_print(id, print_center, "Masz tylko jeden totem ona runde!");
return PLUGIN_CONTINUE;
}
if(inteligencja_gracza[id] < 1)
client_print(id, print_center, "Aby wzmocnic totem, zwieksz inteligencje!");
ilosc_ammo_gracza[id]--;
new Float:origin[3];
entity_get_vector(id, EV_VEC_origin, origin);
new ent = create_entity("info_target");
entity_set_string(ent, EV_SZ_classname, "Ammo");
entity_set_edict(ent, EV_ENT_owner, id);
entity_set_int(ent, EV_INT_solid, SOLID_NOT);
entity_set_vector(ent, EV_VEC_origin, origin);
entity_set_float(ent, EV_FL_ltime, halflife_time() + 7 + 0.1);
entity_set_model(ent, "models/w_medkit.mdl");
set_rendering ( ent, kRenderFxGlowShell, 90,0,0, kRenderFxNone, 255 ) ;
drop_to_floor(ent);
entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.1);
return PLUGIN_CONTINUE;
}
public AmmoThink(ent)
{
new id = entity_get_edict(ent, EV_ENT_owner);
new totem_dist = 400;
new totem_ammo = 5+floatround(inteligencja_gracza[id]*0.5);
if (entity_get_edict(ent, EV_ENT_euser2) == 1)
{
new Float:forigin[3], origin[3];
entity_get_vector(ent, EV_VEC_origin, forigin);
FVecIVec(forigin,origin);
new entlist[33];
new numfound = find_sphere_class(0,"player",totem_dist+0.0,entlist, 32,forigin);
for (new i=0; i < numfound; i++)
{
new pid = entlist[i];
if (get_user_team(pid) != get_user_team(id))
continue;
new ammo = cs_get_weapon_ammo(pid);
new nowe_ammo = (ammo+totem_ammo<maxAmmo[pid])?ammo+totem_ammo:maxAmmo[pid];
if (is_user_alive(pid)) cs_get_weapon_ammo(pid, nowe_ammo); // linia 2195
}//linia 2196
entity_set_edict(ent, EV_ENT_euser2, 0);
entity_set_float(ent, EV_FL_nextthink, halflife_time() + 1.0);
return PLUGIN_CONTINUE;
}
if (entity_get_float(ent, EV_FL_ltime) < halflife_time() || !is_user_alive(id))
{
remove_entity(ent);
return PLUGIN_CONTINUE;
}
if (entity_get_float(ent, EV_FL_ltime)-2.0 < halflife_time())
set_rendering ( ent, kRenderFxNone, 255,255,255, kRenderTransAlpha, 0 ) ;
new Float:forigin[3], origin[3];
entity_get_vector(ent, EV_VEC_origin, forigin);
FVecIVec(forigin,origin);
//Find people near and give them health
message_begin( MSG_BROADCAST, SVC_TEMPENTITY, origin );
write_byte( TE_BEAMCYLINDER );
write_coord( origin[0] );
write_coord( origin[1] );
write_coord( origin[2] );
write_coord( origin[0] );
write_coord( origin[1] + totem_dist );
write_coord( origin[2] + totem_dist );
write_short( sprite_white );
write_byte( 0 ); // startframe
write_byte( 0 ); // framerate
write_byte( 10 ); // life
write_byte( 10 ); // width
write_byte( 255 ); // noise
write_byte( 255 ); // r, g, b
write_byte( 100 );// r, g, b
write_byte( 100 ); // r, g, b
write_byte( 128 ); // brightness
write_byte( 5 ); // speed
message_end();
entity_set_edict(ent, EV_ENT_euser2 ,1);
entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.5);
return PLUGIN_CONTINUE;
}
Blad w liniach
new ammo = cs_get_weapon_ammo(pid);
new nowe_ammo = (ammo+totem_ammo<maxAmmo[pid])?ammo+totem_ammo:maxAmmo[pid];
if (is_user_alive(pid)) cs_get_weapon_ammo(pid, nowe_ammo); // linia 2195
}//linia 2196
Jeżeli będzie potrzeba dania sma proszę pisać.
Z góry dziekuje i pozdrawiam.
@@ Klakier nie działa, nie daje ammo oraz apteczka nie znika po czasie po zmianie rundy apteczka dalej jest na ziemi.
Załączone pliki
Użytkownik Albertd edytował ten post 04.12.2011 22:58