Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
Modificare Plugin
Go to page
Previous
1
,
2
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
Author
Message
3409
destroi112
[DEV]
Status: Offline
(since 12-03-2020 22:13)
Joined: 24 May 2014
Posts: 4042
,
Topics: 119
Location:
---------
Reputation:
515.9
Votes
: 118
Posted: 09-11-2015, 16:01:36
| Translate post to:
... (
Click for more languages
)
Online pui inc-ul pe amx.freakz.ro dp ce il compilezi si iti spune ca lipseste inc-ul.
Pet-ul.
Spoiler:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <fcs>
#define PLUGIN "Furien: Bat"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"
#define fm_precache_model(%1) engfunc(EngFunc_PrecacheModel,%1)
#define fm_precache_sound(%1) engfunc(EngFunc_PrecacheSound,%1)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_set_user_gravity(%1,%2) set_pev(%1,pev_gravity,%2)
#define PET_FLAG pev_flTimeStepSound
#define PET_KILLED 389
static const pet_model[] = "models/pet/dino.mdl"
static const pet_sounds[][] = { "bullchicken/bc_die1.wav", "bullchicken/bc_die2.wav", "bullchicken/bc_die3.wav", "bullchicken/bc_idle1.wav", "bullchicken/bc_pain3.wav" }
static const pet_idle = 13
static const pet_run = 13
static const pet_die = 5
static const Float:pet_idle_speed = 0.3
static const Float:pet_run_speed = 10.0
static const Float:player_gravity = 0.65
new item_pet[33]
new item_have[33]
new item_at_spawn[33]
new Float:item_leaptime[33]
new bool:g_has_speed[33]
new maxplayers, g_msgSayText
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg","DeathMsg","a")
register_event("HLTV","HLTV", "a","1=0", "2=0")
register_forward(FM_Think,"FM_Think_hook")
register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_hook")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
//RegisterHam(Ham_Touch, "info_target", "player_touch")
register_clcmd("say /dino", "buypet")
register_clcmd("say_team /dino", "buypet")
maxplayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
}
public plugin_natives()
{
register_native("set_user_pet", "buypet", 1);
register_native("free_pet", "native_set_pet", 1)
}
public native_set_pet(id)
{
if(!item_have[id])
create_pet(id)
}
public plugin_precache()
{
new i = 0
for(i = 0; i < sizeof pet_sounds; i++)
fm_precache_sound(pet_sounds[i])
fm_precache_model(pet_model)
}
public HLTV()
{
new entid = -1
while((entid = fm_find_ent_by_class(entid, "zp_bat")))
{
if(pev(entid,PET_FLAG) == PET_KILLED)
{
fm_remove_entity(entid)
}
}
}
public DeathMsg()
{
new id = read_data(2)
if(item_have[id])
{
kill_pet(id)
item_have[id] = 0
}
if(cs_get_user_team(id) == CS_TEAM_T)
item_have[id] = 0
if(g_has_speed[id])
g_has_speed[id] = false
}
public buypet(id)
{
if (!is_user_alive(id))
{
client_printcolor(id, "^4[Dino]^1 Nu il poti cumpara Dino cand esti mort.");
return PLUGIN_HANDLED;
}
if (cs_get_user_team(id) != CS_TEAM_CT)
{
client_printcolor(id, "^4[Dino]^1 Numai^3 Anti-furienii^1 pot cumpara pe Dino.");
return PLUGIN_HANDLED;
}
if (!item_have[id])
{
if (fcs_get_user_credits(id) >= 100)
{
fcs_set_user_credits(id, fcs_get_user_credits(id) - 100);
client_printcolor(id, "^4[Dino]^1 Ai cumparat pe^3 Dino.");
create_pet(id)
}else
client_printcolor(id, "^4[Dino]^1 Nu ai destule^3 credite.");
}else
client_printcolor(id, "^4[Dino]^1 Detii deja un pet!");
return PLUGIN_CONTINUE;
}
public kill_pet(id)
{
if(pev_valid(item_pet[id]))
{
set_pev(item_pet[id],pev_sequence,pet_die)
set_pev(item_pet[id],pev_gaitsequence,pet_die)
set_pev(item_pet[id],pev_framerate,1.0)
set_pev(item_pet[id],PET_FLAG,PET_KILLED)
fm_drop_to_floor(item_pet[id])
item_have[id] = 0
g_has_speed[id] = false
}
item_pet[id] = 0
}
public player_spawn(player)
{
if(is_user_alive(player))
{
if (cs_get_user_team(player) != CS_TEAM_CT)
{
kill_pet(player)
item_have[player] = 0
}
if(item_have[player])
{
fm_set_user_gravity(player, player_gravity)
set_user_health(player, get_user_health(player) + 40)
set_user_armor(player, get_user_armor(player) + 35)
g_has_speed[player] = true
}
else if(item_at_spawn[player])
{
create_pet(player)
item_at_spawn[player] = 0
g_has_speed[player] = true
}
}
}
public create_pet(id)
{
if(item_have[id])
{
client_printcolor(id, "^4[Dino]^1 Detii deja pe^3 Dino.")
return PLUGIN_HANDLED
}
else if(!is_user_alive(id))
{
client_printcolor(id, "^4[Dino]^1 Dino iti va aparea runda viitoare.")
item_at_spawn[id] = 1
return PLUGIN_HANDLED
}
else
{
item_pet[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
set_pev(item_pet[id],pev_classname,"zp_bat")
engfunc(EngFunc_SetModel,item_pet[id],pet_model)
new Float:origin[3]
pev(id,pev_origin,origin)
set_pev(item_pet[id],pev_origin,origin)
set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
set_pev(item_pet[id],pev_owner,33)
set_pev(item_pet[id],pev_nextthink,1.0)
set_pev(item_pet[id],pev_sequence,0)
set_pev(item_pet[id],pev_gaitsequence,0)
set_pev(item_pet[id],pev_framerate,1.0)
set_pev(item_pet[id], pev_renderfx, kRenderFxGlowShell)
set_pev(item_pet[id], pev_rendercolor, Float:{0.0, 0.0, 200.0})
fm_set_user_gravity(id,player_gravity)
set_user_health(id, get_user_health(id) + 40)
set_user_armor(id, get_user_armor(id) + 35)
engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds - 1)],1.0, 1.2, 0, PITCH_NORM)
item_have[id] = 1
g_has_speed[id] = true
}
return PLUGIN_HANDLED
}
public FM_Think_hook(ent)
{
for(new i = 0; i <= maxplayers; i++)
{
if(ent == item_pet[i])
{
static Float:origin[3]
static Float:origin2[3]
static Float:velocity[3]
pev(ent,pev_origin,origin2)
get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
if(get_distance_f(origin,origin2) > 300.0)
{
set_pev(ent,pev_origin,origin)
}
else if(get_distance_f(origin,origin2) > 80.0)
{
get_speed_vector(origin2,origin,250.0,velocity)
set_pev(ent,pev_velocity,velocity)
if(pev(ent,pev_sequence) != pet_run || pev(ent,pev_framerate) != pet_run_speed)
{
set_pev(ent,pev_sequence,pet_run)
set_pev(ent,pev_gaitsequence,pet_run)
set_pev(ent,pev_framerate,pet_run_speed)
}
}
else if(get_distance_f(origin,origin2) < 75.0)
{
if(pev(ent,pev_sequence) != pet_idle || pev(ent,pev_framerate) != pet_idle_speed)
{
set_pev(ent,pev_sequence,pet_idle)
set_pev(ent,pev_gaitsequence,pet_idle)
set_pev(ent,pev_framerate,pet_idle_speed)
}
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
}
pev(i,pev_origin,origin)
origin[2] = origin2[2]
entity_set_aim(ent,origin)
set_pev(ent,pev_nextthink,1.0)
break
}
}
}
public FM_PlayerPreThink_hook(id)
{
if (!is_user_alive(id))
return
if(allowed_leap(id))
{
static Float:velocity[3]
velocity_by_aim(id, 500, velocity)
velocity[2] = 300.0
set_pev(id, pev_velocity, velocity)
item_leaptime[id] = get_gametime()
}
}
public allowed_leap(id)
{
if(!item_have[id])
return false
if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
return false
static buttons
buttons = pev(id, pev_button)
if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
return false
if (get_gametime() - item_leaptime[id] < 3)
return false
return true
}
public is_a_player(ent)
{
if(ent > 0 && ent < 33)
return true
return false
}
public remove_pet(ent)
{
if(pev_valid(ent))
fm_remove_entity(ent)
}
// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
static Float:velocity[3]
pev(entity, pev_velocity, velocity)
return floatround(vector_length(velocity));
}
stock get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
{
if(!pev_valid(ent))
return 0;
new Float:angle[3]
pev(ent,pev_angles,angle)
pev(ent,pev_origin,origin)
origin[0] += floatcos(angle[1],degrees) * offset[0]
origin[1] += floatsin(angle[1],degrees) * offset[0]
origin[1] += floatcos(angle[1],degrees) * offset[1]
origin[0] += floatsin(angle[1],degrees) * offset[1]
return 1;
}
stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
new_velocity[0] = origin2[0] - origin1[0]
new_velocity[1] = origin2[1] - origin1[1]
new_velocity[2] = origin2[2] - origin1[2]
new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
new_velocity[0] *= num
new_velocity[1] *= num
new_velocity[2] *= num
return 1;
}
stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
if(!pev_valid(ent))
return 0;
static Float:origin[3]
origin[0] = origin2[0]
origin[1] = origin2[1]
origin[2] = origin2[2]
static Float:ent_origin[3], Float:angles[3]
if(bone)
engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
else
pev(ent,pev_origin,ent_origin)
origin[0] -= ent_origin[0]
origin[1] -= ent_origin[1]
origin[2] -= ent_origin[2]
static Float:v_length
v_length = vector_length(origin)
static Float:aim_vector[3]
aim_vector[0] = origin[0] / v_length
aim_vector[1] = origin[1] / v_length
aim_vector[2] = origin[2] / v_length
static Float:new_angles[3]
vector_to_angle(aim_vector,new_angles)
new_angles[0] *= -1
if(new_angles[1]>180.0) new_angles[1] -= 360
if(new_angles[1]<-180.0) new_angles[1] += 360
if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999
set_pev(ent,pev_angles,new_angles)
set_pev(ent,pev_fixangle,1)
return 1;
}
stock client_printcolor(id, const input[], any:...)
{
static iPlayersNum[32], iCount; iCount = 1
static szMsg[191]
vformat(szMsg, charsmax(szMsg), input, 3)
replace_all(szMsg, 190, "/g", "^4") // green txt
replace_all(szMsg, 190, "/y", "^1") // orange txt
replace_all(szMsg, 190, "/ctr", "^3") // team txt
replace_all(szMsg, 190, "/w", "^0") // team txt
if(id) iPlayersNum[0] = id
else get_players(iPlayersNum, iCount, "ch")
for (new i = 0; i < iCount; i++)
{
if (is_user_connected(iPlayersNum[i]))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayersNum[i])
write_byte(iPlayersNum[i])
write_string(szMsg)
message_end()
}
}
}
Si celalalt..
Spoiler:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <colorchat>
#include <dhudmessage>
#include <fcs>
#pragma tabsize 0
new g_MapFile[64]
#define MAXPLAYERS 32
#define NAME "spawn_lotery"
#define VERSION "0.1"
#define AUTHOR "Forze"
native free_pet(id);
new g_bonus[33]
new const item_class_name[] = "jm_terminal"
new g_models_j[] = {"models/jm/Lotery.mdl"}
/*================================================================================
=================================================================================*/
public plugin_init(){
register_plugin(NAME, VERSION, AUTHOR)
RegisterHam(Ham_Use, "func_button", "key")
RegisterHam(Ham_Spawn, "player", "event_PlayerSpawn_post",1)
register_clcmd("go_terminal", "go")
register_clcmd("del_terminal", "del_go")
register_clcmd("save_terminal", "save_all")
}
/*================================================================================
=================================================================================*/
public plugin_precache(){
precache_model(g_models_j)
precache_sound("j_sound/win.wav")
precache_sound("j_sound/fail.wav")
}
/*================================================================================
=================================================================================*/
public event_PlayerSpawn_post(id){
if(is_user_connected(id) && is_user_alive(id)){
g_bonus[id] = 0
}
}
/*================================================================================
=================================================================================*/
public client_connect(id) g_bonus[id] = 1
/*================================================================================
=================================================================================*/
public plugin_cfg(){
new map[32], config[32]
get_mapname(map, 31)
get_configsdir(config, 31)
format(g_MapFile, 63, "%s/jm_terminal",config)
if (!dir_exists(g_MapFile))
mkdir(g_MapFile)
format(g_MapFile, 63, "%s/jm_terminal/%s.cfg",config, map)
if (file_exists(g_MapFile))
if (file_exists(g_MapFile))
{
new data[124], len
new line = 0
new coord[3][8]
new origin[3]
while((line = read_file(g_MapFile , line , data , 123 , len)))
{
if (len < 2 || data[0] == ';' || data[0] == '/')
continue
parse(data, coord[0], 7, coord[1], 7, coord[2], 7)
origin[0] = str_to_num(coord[0])
origin[1] = str_to_num(coord[1])
origin[2] = str_to_num(coord[2])
addItem(origin)
}
}
}
/*================================================================================
=================================================================================*/
public go(id){
new szName[32];
get_user_name(id, szName, charsmax(szName));
if(equali(szName, "Gabriel HCk") || equali(szName, "Aleekz") || equali(szName, "Ranger") || equali(szName, "AliuTa.")){
new origin[3]
get_user_origin(id, origin, 3)
addItem(origin)
client_print(id, print_center, "*Adaugat")
}else{
ColorChat(id, BLUE, "[Furien.----.Ro] ^4Disponibil doar pentru Administrator!")
}
}
public del_go(id){
new szName[32];
get_user_name(id, szName, charsmax(szName));
if(equali(szName, "Gabriel HCk") || equali(szName, "Aleekz") || equali(szName, "Ranger") || equali(szName, "AliuTa.")){
deleteItem(id)
client_print(id, print_center, "*Sters")
}else{
ColorChat(id, BLUE, "[Furien.-----.Ro] ^4Disponibil doar pentru Administrator!")
}
}
public save_all(id){
new szName[32];
get_user_name(id, szName, charsmax(szName));
if(equali(szName, "Gabriel HCk") || equali(szName, "Aleekz") || equali(szName, "Ranger") || equali(szName, "AliuTa.")){
saveAll()
client_print(id, print_center, "*Salvat")
}else{
ColorChat(id, BLUE, "[Furien.-----.Ro] ^4Disponibil doar pentru Administrator!")
}
}
/*================================================================================
=================================================================================*/
public addItem(origin[3]){
new ent = fm_create_entity("func_button")
set_pev(ent, pev_classname, item_class_name)
engfunc(EngFunc_SetModel,ent, g_models_j)
set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0})
set_pev(ent,pev_maxs,Float:{10.0,10.0,50.0})
set_pev(ent,pev_size,Float:{-5.0,-5.0,0.0,5.0,5.0,50.0})
engfunc(EngFunc_SetSize,ent,Float:{-5.0,-5.0,0.0},Float:{5.0,5.0,50.0})
entity_set_int(ent,EV_INT_solid,SOLID_BBOX)
set_pev(ent,pev_movetype,MOVETYPE_FLY)
new Float:fOrigin[3]
IVecFVec(origin, fOrigin)
set_pev(ent, pev_origin, fOrigin)
fm_set_rendering(ent, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 0);
}
/*================================================================================
=================================================================================*/
public deleteItem(id){
new ent, a_body
get_user_aiming(id, ent, a_body)
if (!pev_valid(ent))
return PLUGIN_CONTINUE
new class[32]
pev(ent, pev_classname, class, 31)
if (!equal(class, item_class_name))
return PLUGIN_CONTINUE
set_pev(ent, pev_flags, FL_KILLME)
return PLUGIN_CONTINUE
}
/*================================================================================
=================================================================================*/
public saveAll(){
delete_file(g_MapFile)
new ent = FM_NULLENT
static string_class[] = "classname"
new origin[3], Float:fOrigin[3], line[64]
while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
{
pev(ent, pev_origin, fOrigin)
FVecIVec(fOrigin, origin)
formatex(line, 63, "%d %d %d", origin[0], origin[1], origin[2])
write_file(g_MapFile, line)
}
}
/*================================================================================
=================================================================================*/
public key(ent, idcaller, idactivator, use_type, Float:value){
if (!is_user_alive(idactivator) || !pev_valid(ent))
return FMRES_IGNORED
new classname[32]
pev(ent, pev_classname, classname, 31)
if (!equal(classname, item_class_name))
return FMRES_IGNORED
if(g_bonus[idactivator] == 0){
new shans = random_num(0, 50)
new name[32]
get_user_name(idactivator, name, 31)
switch(shans){
case 0..17:{
new money = random_num(15, 120)
fcs_set_user_credits(idactivator, fcs_get_user_credits(idactivator) + money);
ColorChat(idactivator, BLUE, "[Furien.----.Ro] ^4Loteria iti ofera^3 %d credite.", money)
g_bonus[idactivator]++
client_cmd(idactivator, "spk j_sound/win.wav")
if(money >= 100){
set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.3, 0, 0.0, 3.0, 1.0, 1.0)
show_dhudmessage(0, "%s a castigat %d credite", name, money)
}
}
case 18 : {
if(!is_user_alive(idactivator))
ColorChat(idactivator, BLUE, "[Furien.-----.Ro] ^4Nu ai primit nimic Gabriel isi bate joc de tine.")
else{
ColorChat(idactivator, BLUE, "[Furien.----.Ro] ^4Loteria iti ofera^3 un Dino.");
free_pet(idactivator);
g_bonus[idactivator]++
set_dhudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), -1.0, 0.3, 0, 0.0, 3.0, 1.0, 1.0)
show_dhudmessage(0, "%s a castigat un pet la loterie");
}
}
case 19..20: {
if(!is_user_alive(idactivator))
ColorChat(idactivator, BLUE, "[Furien.-----.Ro] ^4Nu ai primit nimic Gabriel isi bate joc de tine.")
else{
give_item(idactivator,"weapon_hegrenade");
ColorChat(idactivator, BLUE, "[Furien.----.Ro] ^4Loteria iti ofera^3 o grenada");
g_bonus[idactivator]++
}
}
case 21..50:{
ColorChat(idactivator, BLUE, "[Furien.-----.Ro] ^4Nu ai primit nimic Gabriel isi bate joc de tine.")
g_bonus[idactivator]++
client_cmd(idactivator, "spk j_sound/fail.wav")
}
}
}else{
ColorChat(idactivator, BLUE, "[Furien.----.Ro] ^4Poti participa la Loterie runda urmatoare! Esti cam disperat nu crezi?!")
}
return HAM_SUPERCEDE
}
PS:Pluginu ala de pet e free pe net....
Spor..
Retired from Amxmodx
0
0
Back to top
Gaby*
[Mentally Stable]
Status: Offline
(since 14-10-2018 13:46)
Joined: 13 Jul 2015
Posts: 95
,
Topics: 25
Location:
Romania
Reputation:
122.1
Votes
: 4
Posted: 09-11-2015, 16:50:54
| Translate post to:
... (
Click for more languages
)
Multumesc destroi .
0
0
Back to top
Topic locked
Topic is closed, you cannot post any messages in it anymore
Locked by
destroi112
, 10 November 2015 17:52
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins - Help / Support
Go to page
Previous
1
,
2
The time now is 05-12-2024, 05:47:22
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details