CSPLague
Basit bir istek. - Printable Version

+- CSPLague (https://www.csplague.com)
+-- Forum: CS 1.6 Plugin (Eklenti) Bölümü (https://www.csplague.com/forumdisplay.php?fid=6)
+--- Forum: [İSTEK] Cs 1.6 Plugin İstek Bölümü (https://www.csplague.com/forumdisplay.php?fid=80)
+---- Forum: Çözülmüş İstekler (https://www.csplague.com/forumdisplay.php?fid=87)
+---- Thread: Basit bir istek. (/showthread.php?tid=6821)



Basit bir istek. - buyukkaptan90 - 21-02-13

Aşağıda kodlarını verdiğim pluginin sadece de_dust mapında çalışmasını istiyorum şimdiden teşekkürler Smile

PHP Code:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

#define MAX_PLAYERS 32

#define THROWING

#if !defined THROWING
#include <xs>
#endif

enum _:Room {
    
Room_G,
    
Room_M
};

new const 
gRoomNames[Room][] = {
    
"GU",
    
"M"
};

new const 
gRoomCvarNames[Room][] = {
    
"gu",
    
"ma"
};

enum _:Setting {
    
Setting_AbsMins,
    
Setting_AbsMaxs,
    
Setting_Throw_Origin,
    
Setting_Throw_Angles
};

new const 
Float:gRoomSettings[Room][Setting][3] = {
 
    {
        
// absmins
        
{ -713.0,  -990.0,  -157.0},
       

        { 
2375.0,   193.0, -2361.0},
      
    }
};

new 
Float:gEnterRoomTime[MAX_PLAYERS 1][Room];

new 
gCvarNoKill[Room];
new 
gCvarThrowTime[Room];
#if !defined THROWING_IS_TELEPORTING
new gCvarThrowSpeed[Room];
#endif

public plugin_init() {
    
register_plugin("No Killing Zones""0.0.5""Exolent");
    
    
RegisterHam(Ham_TakeDamage"player""FwdPlayerDamage");
    
RegisterHam(Ham_TraceAttack"player""FwdPlayerTraceAttack");
    
    new 
cvarName[64];
    for(new 
room 0room Roomroom++) {
        
formatex(cvarNamecharsmax(cvarName), "nkz_nokill_%s"gRoomCvarNames[room]);
        
gCvarNoKill[room] = register_cvar(cvarName"1");
        
        
formatex(cvarNamecharsmax(cvarName), "nkz_throw_%s_time"gRoomCvarNames[room]);
        
gCvarThrowTime[room] = register_cvar(cvarName"10");
        
#if !defined THROWING_IS_TELEPORTING
        
formatex(cvarNamecharsmax(cvarName), "nkz_throw_%s_speed"gRoomCvarNames[room]);
        
gCvarThrowSpeed[room] = register_cvar(cvarName"1000");
#endif
    
}
}

public 
FwdPlayerDamage(victiminflictorattackerFloat:damagedamageBits) {
    
// if player is hit by a grenade?
    
if(inflictor != attacker) {
        
// check if player is in a room
        
for(new room 0room Roomroom++) {
            
// if player has entered the room
            
if(gEnterRoomTime[victim][room] > 0.0) {
                
// block damage
                
return HAM_SUPERCEDE;
            }
        }
    }
    
    return 
HAM_IGNORED;
}

public 
FwdPlayerTraceAttack(victimattackerFloat:damageFloat:direction[3], tracedamageBits) {
    
// check if player or attacker are in a room
    
for(new room 0room Roomroom++) {
        
// if player or attacker have entered the room
        
if(gEnterRoomTime[victim][room] > 0.0 || gEnterRoomTime[attacker][room] > 0.0) {
            
// block damage
            
return HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;
}

public 
client_PreThink(id) {
    static 
lastAlive[MAX_PLAYERS 1];
    static 
Float:lastMessage[MAX_PLAYERS 1];
    
    if(
is_user_alive(id)) {
        new 
Float:origin[3];
        
entity_get_vector(idEV_VEC_originorigin);
        
        new 
Float:gametime get_gametime();
        new 
Float:throwtime;
        new 
length[64];
#if !defined THROWING_IS_TELEPORTING
        
new Float:velocity[3];
#endif
        
        
for(new room 0room Roomroom++) {
            if((
gRoomSettings[room][Setting_AbsMins][0] <= origin[0] <= gRoomSettings[room][Setting_AbsMaxs][0])
            && (
gRoomSettings[room][Setting_AbsMins][1] <= origin[1] <= gRoomSettings[room][Setting_AbsMaxs][1])
             && (
gRoomSettings[room][Setting_AbsMins][2] <= origin[2]  <= gRoomSettings[room][Setting_AbsMaxs][2])) {
                if(
gEnterRoomTime[id][room] == 0.0) {
                    
gEnterRoomTime[id][room] = gametime;
                }
                
                
throwtime get_pcvar_float(gCvarThrowTime[room]);
                
                if(
throwtime 0.0) {
                    
// if they are not being thrown yet
                    
if((gEnterRoomTime[id][room] + throwtime) >= gametime) {
                        
// if they can be told they are here
                        
if((lastMessage[id] + 0.2) < gametime) {
                            
// get how long they have before they will be thrown
                            
get_time_length(gEnterRoomTime[id][room] + throwtime gametimelengthcharsmax(length));
                            
                            
// tell player they are in the room
                            
set_hudmessage(25500, .holdtime 0.3, .fadeintime 0.0, .fadeouttime 0.0, .channel 2);
                             
show_hudmessage(id"Bulundugun Bolge %s, .Burada Beklemek YASAKTIR.  Otomatik Isinlanmaya son %s"gRoomNames[room], length);
                            
                            
// save when last message was sent
                            
lastMessage[id] = gametime;
                        }
                    } else {
#if !defined THROWING_IS_TELEPORTING
                        // grab player's current velocity
                        
entity_get_vector(idEV_VEC_velocityvelocity);
                        
                        
// store Z velocity
                        
throwtime velocity[2];
                        
                        
// calculate direction of player's position to throw position
                        
xs_vec_sub(gRoomSettings[room][Setting_Throw_Origin], originvelocity);
                        
                        
// remove any Z offsets
                        
velocity[2] = 0.0;
                        
                        
// set the speed of the velocity
                        
xs_vec_mul_scalar(velocityget_pcvar_float(gCvarThrowSpeed[room]) / vector_length(velocity), velocity);
                        
                        
// restore the Z velocity
                        
velocity[2] = throwtime;
                        
                        
// set player's velocity towards the throw position
                        
entity_set_vector(idEV_VEC_velocityvelocity);
#else
                        // set player's origin to teleport out
                        
entity_set_origin(idgRoomSettings[room][Setting_Throw_Origin]);
#endif
                        
                        // set player's angles while being thrown?
                        
entity_set_vector(idEV_VEC_anglesgRoomSettings[room][Setting_Throw_Angles]);
                        
entity_set_int(idEV_INT_fixangle1);
                    }
                }
            } else {
                
gEnterRoomTime[id][room] = 0.0;
            }
        }
        
        
lastAlive[id] = 1;
    } else if(
lastAlive[id]) {
        
arrayset(_:gEnterRoomTime[id], _:0.0Room);
        
        
lastAlive[id] = 0;
    }
}

get_time_length(Float:Saniyesoutput[], output_len) {
    new 
_Saniyes floatround(Saniyesfloatround_ceil);
    
    new const 
unit_mults[] = {
        
60,
        
1
    
};
    new const 
unit_names[sizeof(unit_mults)][2][] = {
        {
"Dakika""Dakikas"},
        {
"Saniye""Saniyes"}
    };
    
    new 
unit_values[sizeof(unit_mults)][2];
    new 
num_units;
    
    for(new 
0valsizeof(unit_mults); i++) {
        
val _Saniyes unit_mults[i];
        
        if(
val) {
            
unit_values[num_units][0] = val;
            
unit_values[num_units][1] = i;
            
num_units++;
            
            
_Saniyes %= unit_mults;
        }
    }
    
    new 
len output[0] = 0;
    
    for(new 
0num_unitsi++) {
        
len += formatex(output[len], output_len len"%s%s%d %s",
            (
&& num_units 2) ? ", " "",
            ((
== (num_units 1) && num_units 1) ? (num_units "and " " and ") : ""),
            
unit_values[0],
            
unit_names[unit_values[1]][unit_values[0] != 1]
            );
    }
    
    return 
len;

[/i][/i][/i][/i][/i]


Cevap: Basit bir istek. - mertcanen - 21-02-13

de_ mi yoksa de_dust tamı yoksa d2 demi ?


Cevap: Basit bir istek. - buyukkaptan90 - 21-02-13

de_dust


Cevap: Basit bir istek. - akcaliberkk - 21-02-13

Bunu ekle
PHP Code:
public plugin_cfg() {
    new 
mapname[32];
    
get_mapname(mapname,31)
    if(!
equali(mapname,"de_dust")) set_fail_state("Plugin Yalnizca ^"de_dust2^" Mapinde Calisir")




Cevap: Basit bir istek. - JDM - 22-02-13

pluginde
PHP Code:
#include <xs> 
eksik


Cevap: Basit bir istek. - HijyeniK - 22-02-13

Konu açarken başlıkta isteğin hakkında bilgi vermelisin.
Basit bir istek, içeri girin vs. gibi olmaz.



Cevap: Basit bir istek. - buyukkaptan90 - 22-02-13

akcaliberkk dateline='' Wrote: Bunu ekle
PHP Code:
public plugin_cfg() {
    new 
mapname[32];
    
get_mapname(mapname,31)
    if(!
equali(mapname,"de_dust")) set_fail_state("Plugin Yalnizca ^"de_dust2^" Mapinde Calisir")


Teşekkürler Berk


Cevap: Basit bir istek. - akcaliberkk - 23-02-13

Çözülmüş İsteklere taşındı.