Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Modyfikacja

Przerobienie Sklepiku HNS

Modyfikacja

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Pazdzioch

    Życzliwy

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:24
  • Lokalizacja:Bytom
Offline

Napisano 16.01.2012 18:13

proszę o przerobienie tego sklepiku mianowicie chce zeby mi ktos zrobil respienie 1x na runde

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "HnS MyShop"
#define VERSION "1.0"
#define AUTHOR "R3X"

#define LOTTO_SHOT 25

enum Color {
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
};

new TeamName[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
};
enum HnSShop{
ITEM_FLASH,
ITEM_HE,
ITEM_SG,
ITEM_RESPAWN,
ITEM_SUPERHE,
ITEM_LOTTO
};
enum HnSShopLotto{
LOTTO_INV,
LOTTO_SPEED,
LOTTO_pHP,
LOTTO_pFRAGS,
LOTTO_mFRAGS,
};

#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
#define KeysGanianyShop (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9) // Keys: 12340

new gmsgScoreInfo;

new gcvarItems[HnSShop];
new gcvarSuperHEPow;
new gcvarPlusFragPow, gcvarMinusFragPow;
new gcvarSuperSpeedPow;
new gcvarHPPow;

new bool:gbSpeed[33];
new bool:gbLotted[33];
new bool:gbSuperHe[33];
new bool:gbgranaty[33];

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("say kup","ShowGanianyShop");
register_clcmd("say /kup","ShowGanianyShop");
register_clcmd("say_team kup","ShowGanianyShop");
register_clcmd("say_team /kup","ShowGanianyShop");

gcvarItems[ITEM_FLASH]= register_cvar("ganiany_flash_cost","5");
gcvarItems[ITEM_HE]= register_cvar("ganiany_he_cost","7");
gcvarItems[ITEM_SG]= register_cvar("ganiany_smoke_cost","8");
gcvarItems[ITEM_RESPAWN]=register_cvar("ganiany_respawn_cost","12");
gcvarItems[ITEM_SUPERHE]=register_cvar("ganiany_superhe_cost","15");
gcvarItems[ITEM_LOTTO]=register_cvar("ganiany_lotto_cost","6");

gcvarHPPow=register_cvar("ganiany_hp_power","20");

gcvarPlusFragPow=register_cvar("ganiany_plus_frag_power","6");
gcvarMinusFragPow=register_cvar("ganiany_minus_frag_power","6");

gcvarSuperHEPow=register_cvar("ganiany_superhe_power","300");
gcvarSuperSpeedPow=register_cvar("ganiany_superspeed_power","290");

register_event("HLTV", "eventRoundInit", "a", "1=0", "2=0");
register_event("CurWeapon","eventCurWeapon","be","1=1");

RegisterHam(Ham_TakeDamage, "player","fwTakeDamage",1);

register_forward(FM_SetModel, "fwSetModel",1);

register_menucmd(register_menuid("GanianyShop"), KeysGanianyShop, "PressedGanianyShop")
gmsgScoreInfo=get_user_msgid("ScoreInfo");

//register_clcmd("test","test");
}
public test(id){
if(cs_get_user_bpammo(id, CSW_HEGRENADE)==0)
fm_give_item(id, "weapon_hegrenade");
gbSuperHe[id]=true;
}
public fwSetModel(ent, const model[]){
new szClass[32];
pev(ent, pev_classname, szClass, 31);
if(!equal(szClass, "grenade"))
return FMRES_IGNORED;
if(equal(model[7],"w_hegrenade.mdl")){
new id=pev(ent, pev_owner);
if(is_user_connected(id)){
if(gbSuperHe[id]){
set_pev(ent, pev_iuser1, 1);

gbSuperHe[id]=false;
}
}
}
return FMRES_IGNORED;
}
public fwTakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
if(is_user_connected(idattacker) && idinflictor!=idattacker/* && this!=idattacker*/){
if(damagebits==16777216){
//Nade Attack
if(pev(idinflictor, pev_iuser1)){
makeBoom(this, idinflictor);
}
}
}
}
public makeBoom(id, ent){

new Float:fStart[3], Float:fEnd[3];
pev(id, pev_origin, fStart);
pev(ent, pev_origin, fEnd);


getNormal(fStart, fEnd,fStart);

new Float:fPower=get_pcvar_float(gcvarSuperHEPow);
fStart[0] *= fPower;
fStart[1] *= fPower;
fStart[2] *= -fPower;

if(pev(id, pev_flags)&FL_ONGROUND)
fStart[2] += 45.0;

set_pev(id, pev_velocity, fStart);

}
stock getNormal(const Float:o1[3], const Float:o2[3], Float:normal[3]){
normal[0] = o1[0] - o2[0];
normal[1] = o1[1] - o2[1];
normal[2] = - o1[2] + o2[2];

vector_to_angle(normal, normal);
angle_vector(normal, ANGLEVECTOR_FORWARD, normal);
}
public eventCurWeapon(id){
if(gbSpeed[id]){
set_superspeed(id);
}
}
public eventAmmoX(id){
if(gbSuperHe[id]){
if(cs_get_user_bpammo(id, CSW_HEGRENADE)==0)
gbSuperHe[id]=false;
}

}
set_superspeed(id){
new Float:SUPERSPEED=get_pcvar_float(gcvarSuperSpeedPow);
set_pev(id, pev_maxspeed, SUPERSPEED);
client_cmd(id, "cl_forwardspeed %.1f",SUPERSPEED);
client_cmd(id, "cl_backspeed %.1f",SUPERSPEED);
client_cmd(id, "cl_sidespeed %.1f",SUPERSPEED);
}
public client_putinserver(id){
gbSpeed[id]=false;
gbLotted[id]=false;
gbgranaty[id]=false;
}
public eventRoundInit(){
for(new i=1;i<33;i++){
gbSpeed[i]=false;
gbLotted[i]=false;
gbgranaty[i]=false;
}
}
public refreshFrags(id){
new ideaths=cs_get_user_deaths(id);
new ifrags=pev(id, pev_frags);
new kteam=_:cs_get_user_team(id);

message_begin( MSG_ALL, gmsgScoreInfo, {0,0,0}, 0 );
write_byte( id );
write_short( ifrags );
write_short( ideaths);
write_short( 0 );
write_short( kteam );
message_end();
}
stock fm_give_item( index, const item[] ) {
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5))
return 0;

new ent = fm_create_entity(item);
if (!pev_valid(ent))
return 0;

new Float:origin[3];
pev(index, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);

new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, index);
if (pev(ent, pev_solid) != save)
return ent;

engfunc(EngFunc_RemoveEntity, ent);

return -1;
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
new Float:RenderColor[3]
RenderColor[0] = float®
RenderColor[1] = float(g)
RenderColor[2] = float(B)

set_pev(entity, pev_renderfx, fx)
set_pev(entity, pev_rendercolor, RenderColor)
set_pev(entity, pev_rendermode, render)
set_pev(entity, pev_renderamt, float(amount))

return 1
}

public ShowGanianyShop(id) {
new CsTeams:iTeam=cs_get_user_team(id);
if(iTeam!=CS_TEAM_CT && iTeam!=CS_TEAM_T){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Dostepny tylko dla CT i TE");
return PLUGIN_HANDLED;
}
new szMenu[256];
formatex(szMenu, 255,"\yGaniany Sklep^n\w^n\r1.\w Flash - \y%d fragi^n\r2.\w He Grenade - \y%d fragi^n\r3.\w Smoke - \y%d fragow^n\r4.\w Respawn - \y%d fragow^n\r5.\w SuperHe - \y%d fragow^n\r6.\w Loteria - \y%d fragow^n^n\r0.\w Wyjscie",
get_pcvar_num(gcvarItems[ITEM_FLASH]), get_pcvar_num(gcvarItems[ITEM_HE]),get_pcvar_num(gcvarItems[ITEM_SG]),get_pcvar_num(gcvarItems[ITEM_RESPAWN]), get_pcvar_num(gcvarItems[ITEM_SUPERHE]), get_pcvar_num(gcvarItems[ITEM_LOTTO]));
show_menu(id, KeysGanianyShop, szMenu, -1, "GanianyShop") // Display menu
return PLUGIN_CONTINUE;
}

public PressedGanianyShop(id, key) {
if(key==9)
return PLUGIN_HANDLED;
/* Menu:
* Ganiany Sklep
*
* 1. Flash - 5 fragi
* 2. He Grenade - 7 fragi
* 3. Smoke - 8 fragow
* 4. Respawn - 12 fragow
* 5. SuperHE - 15 fragow
*
* 0. Wyście
*/
new iFrags=pev(id, pev_frags);
iFrags-=get_pcvar_num(gcvarItems[HnSShop:key]);
if(iFrags<0){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Masz za malo fragow");
return PLUGIN_HANDLED;
}

switch (key) {
case 0: { // 1
if(!is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc zywy!");
return PLUGIN_HANDLED;
}
if(cs_get_user_bpammo(id, CSW_FLASHBANG)>=2) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Masz juz 2 flashbangi.");
return PLUGIN_HANDLED;
}
fm_give_item(id, "weapon_flashbang");
}
case 1: { // 2
if(!is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc zywy!");
return PLUGIN_HANDLED;
}
if(cs_get_user_bpammo(id, CSW_HEGRENADE)>=1) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Masz juz granat.");
return PLUGIN_HANDLED;
}
if(gbgranaty[id]){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Juz kupiles granata w tej rundzie");
return PLUGIN_HANDLED;
}
fm_give_item(id, "weapon_hegrenade");
gbgranaty[id]=true;
}
case 2: { // 3
if(!is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc zywy!");
return PLUGIN_HANDLED;
}
if(cs_get_user_bpammo(id, CSW_SMOKEGRENADE)>=1) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Masz juz zamrazajacy granat.");
return PLUGIN_HANDLED;
}
if(gbgranaty[id]){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Juz kupiles granata w tej rundzie");
return PLUGIN_HANDLED;
}
fm_give_item(id, "weapon_smokegrenade");
gbgranaty[id]=true;
}
case 3: { // 4
if(is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc martwy!");
return PLUGIN_HANDLED;
}
set_task(0.5, "respawn_player",id);


}
case 4: { // 5
if(!is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc zywy!");
return PLUGIN_HANDLED;
}
if(gbgranaty[id]){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Juz kupiles granata w tej rundzie");
return PLUGIN_HANDLED;
}
fm_give_item(id, "weapon_hegrenade");
gbSuperHe[id]=true;
gbgranaty[id]=true;
}
case 5: { //6
if(!is_user_alive(id)) {
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Musisz byc zywy!");
return PLUGIN_HANDLED;
}
if(gbLotted[id]){
ColorChat(id, BLUE, "^x04[Ganiany Sklep]^x01 Juz raz losowales w tej rundzie!");
return PLUGIN_HANDLED;
}
set_pev(id, pev_frags, float(iFrags));
random_lottoitem(id);
gbLotted[id]=true;
refreshFrags(id);
return PLUGIN_CONTINUE;
}
}
set_pev(id, pev_frags, float(iFrags));
refreshFrags(id);
return PLUGIN_CONTINUE;
}
random_lottoitem(id){
new CsTeams:iTeam=cs_get_user_team(id);
new Color:iColor;
if(iTeam==CS_TEAM_CT)
iColor=BLUE;
else if(iTeam==CS_TEAM_T)
iColor=RED;
else
return 0;
new szTitle[20];
new szName[32];
get_user_name(id, szName, 31);
switch(random_num(0, _:HnSShopLotto-1)){
case LOTTO_INV:{
copy(szTitle, 19, "Granat");
//+Granat
switch(random_num(0, 3)){
case 0:{
fm_give_item(id, "weapon_flashbang");
}
case 1:{
fm_give_item(id, "weapon_smokegrenade");
}
case 2:{
fm_give_item(id, "weapon_hegrenade");
}
case 3:{
if(cs_get_user_bpammo(id, CSW_HEGRENADE)==0)
fm_give_item(id, "weapon_hegrenade");
gbSuperHe[id]=true;
}
}

}
case LOTTO_pHP:{
new iBonus=get_pcvar_num(gcvarHPPow);
formatex(szTitle, 19, "+%d HP", iBonus);

new Float:fHP;
pev(id, pev_health, fHP);
set_pev(id, pev_health, fHP+float(iBonus));
}
case LOTTO_SPEED:{
copy(szTitle, 19, "+Szybkosc");
gbSpeed[id]=true;
set_superspeed(id);
}
case LOTTO_pFRAGS:{
new iBonus=get_pcvar_num(gcvarPlusFragPow);
formatex(szTitle, 19, "+%d fragow", iBonus);
new Float:fFrags;
pev(id, pev_frags,fFrags);
set_pev(id, pev_frags,fFrags+float(iBonus));
refreshFrags(id)
}
case LOTTO_mFRAGS:{
new iBonus=get_pcvar_num(gcvarMinusFragPow);
formatex(szTitle, 19, "-%d fragow",iBonus);
new Float:fFrags;
pev(id, pev_frags,fFrags);
set_pev(id, pev_frags,fFrags-float(iBonus));
refreshFrags(id)
}
default:{
return 0;
}
}
ColorChat(id, iColor, "^x04[Ganiany Sklep]^x01 Gracz^x03 %s^x01 wylosowal^x04 %s^x01 !", szName, szTitle);
return 1;
}
//by Miczu
public respawn_player(id){
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR) return;

set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
dllfunc(DLLFunc_Think, id)

if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
{
dllfunc(DLLFunc_Spawn, id)
}
if(gbSpeed[id]){
set_superspeed(id);
}
}
// ColorChat - Start
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) {
new message[256];

switch(type) {
case NORMAL: message[0] = 0x01;
case GREEN: message[0] = 0x04;
default: message[0] = 0x03;
}

vformat(message[1], 251, msg, 4);

// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';

new team, ColorChange, index, MSG_Type;

if(id) {
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}

team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);

ShowColorMessage(index, MSG_Type, message);

if(ColorChange)
Team_Info(index, MSG_Type, TeamName[team]);
}

ShowColorMessage(id, type, message[]) {
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used) {
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id);
write_string(message);
message_end();
}

Team_Info(id, type, team[]) {
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used) {
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();

return 1;
}

ColorSelection(index, type, Color:Type) {
switch(Type) {
case RED: return Team_Info(index, type, TeamName[1]);
case BLUE: return Team_Info(index, type, TeamName[2]);
case GREY: return Team_Info(index, type, TeamName[0]);
}

return 0;
}

FindPlayer(){
new i = -1;

while(i <= get_maxplayers())
if(is_user_connected(++i))
return i;

return -1;
}
  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: Modyfikacja

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych