Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- #include <engine>
- #include <fakemeta>
- #include <fun>
- #include <hamsandwich>
- #include <stripweapons>
- #include <ColorChat>
- #define FLAG ADMIN_LEVEL_H
- new Array:gArray, bool:gVip[33], jumps[33], weaponID;
- new const onlineCommandVIP[][] =
- {
- "/vips",
- "vips",
- "/vipy",
- "vipy"
- };
- new const motdCommandVIP[][] =
- {
- "/vip",
- "vip"
- };
- new const vipPrefix[] = "[^x04VIP^x01]";
- public plugin_init()
- {
- register_plugin("Paintball: Vip", "1.0", "AMXX.PL");
- register_forward(FM_CmdStart, "cmdStartPre");
- RegisterHam(Ham_Spawn, "player", "spawnedEventPre", 1);
- register_message(get_user_msgid("ScoreAttrib"), "vipStatus");
- registerCommands(onlineCommandVIP, sizeof(onlineCommandVIP), "showVips");
- registerCommands(motdCommandVIP, sizeof(motdCommandVIP), "descrVIP");
- register_message(get_user_msgid("SayText"), "handleSayText");
- set_task(30.0, "information", .flags = "b");
- gArray = ArrayCreate(64, 32);
- }
- public client_authorized(index, const authid[])
- {
- if(get_user_flags(index) & FLAG)
- {
- client_authorized_vip(index);
- }
- }
- public client_authorized_vip(index)
- {
- gVip[index] = true;
- new name[64], gName[64];
- new gSize = ArraySize(gArray);
- get_user_name(index, name, charsmax(name));
- for(new i = 0; i < gSize; i++)
- {
- ArrayGetString(gArray, i, gName, charsmax(gName));
- }
- ArrayPushString(gArray, gName);
- return PLUGIN_CONTINUE;
- }
- public client_disconnected(index)
- {
- if(gVip[index])
- {
- client_disconnect_vip(index);
- }
- }
- public client_disconnect_vip(index)
- {
- gVip[index] = false;
- new name[64], gName[64],
- gSize = ArraySize(gArray);
- get_user_name(index, name, charsmax(name));
- for(new i = 0; i < gSize; i++)
- {
- ArrayGetString(gArray, i, name, charsmax(gName));
- if(equal(name, gName))
- {
- ArrayDeleteItem(gArray, i);
- break;
- }
- }
- }
- public cmdStartPre(index, uc_handle)
- {
- if(gVip[index])
- {
- if(is_user_alive(index))
- {
- cmdStartPreVip(index, uc_handle);
- }
- }
- }
- public cmdStartPreVip(index, uc_handle)
- {
- new flags = pev(index, pev_flags);
- if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(index, pev_oldbuttons) & IN_JUMP) && jumps[index] > 0)
- {
- new Float:velocity[3];
- --jumps[index];
- pev(index, pev_velocity, velocity);
- velocity[2] = random_float(265.0, 285.0);
- set_pev(index, pev_velocity, velocity);
- }
- else if(flags & FL_ONGROUND && jumps[index] != -1)
- {
- jumps[index] = 1;
- }
- }
- public spawnedEventPre(index)
- {
- if(gVip[index])
- {
- if(is_user_alive(index))
- {
- spawnedEventPreVip(index);
- }
- }
- }
- public spawnedEventPreVip(index)
- {
- jumps[index] = 1;
- StripWeapons(index, Primary);
- give_item(index, "weapon_p90");
- give_item(index, "ammo_57mm");
- weaponID = find_ent_by_owner(-1, "weapon_p90", index);
- if(weaponID)
- {
- cs_set_weapon_ammo(weaponID, 50);
- }
- cs_set_user_bpammo(index, CSW_P90, 160);
- }
- public vipStatus()
- {
- new index = get_msg_arg_int(1);
- if(is_user_alive(index) && gVip[index])
- {
- set_msg_arg_int(2, ARG_BYTE, get_msg_arg_int(2) | 4);
- }
- }
- public showVips(index)
- {
- new name[64], message[192],
- gSize = ArraySize(gArray);
- for(new i = 0; i < gSize; i++)
- {
- ArrayGetString(gArray, i, name, charsmax(name));
- add(message, charsmax(message), name);
- if(i == gSize -1)
- {
- add(message, charsmax(message), ".");
- }
- else
- {
- add(message, charsmax(message), ",");
- }
- }
- ColorChat(index, NORMAL, "%s Vipy dostepne na serwerze:^x04 %s", vipPrefix, message);
- }
- public clinet_infochanged(index)
- {
- if(gVip[index])
- {
- new name[64], gName[64];
- get_user_info(index, "name", name, charsmax(name));
- get_user_name(index, gName, charsmax(gName));
- if(!equal(name, gName))
- {
- new gSize = ArraySize(gArray),
- szName[64];
- for(new i = 0; i < gSize; i++)
- {
- ArrayGetString(gArray, i, szName, charsmax(szName));
- if(equal(szName, gName))
- {
- ArrayDeleteItem(gArray, i);
- break;
- }
- }
- }
- }
- }
- public plugin_end()
- {
- ArrayDestroy(gArray);
- }
- public descrVIP(index)
- {
- show_motd(index, "vip.txt", "Infomracje o vip'ie");
- }
- public information(index)
- {
- ColorChat(index, NORMAL, "%s Aby dowiedzic sie co posiada^x04 VIP^x01, wpisz na say'u^x03 /vip^x01", vipPrefix);
- }
- public handleSayText(msgId, msgDest, msgEnt) {
- new id = get_msg_arg_int(1);
- if(!is_user_connected(id) || !gVip[id]) return PLUGIN_CONTINUE;
- new szTmp[192], szTmp2[192];
- get_msg_arg_string(2, szTmp, charsmax(szTmp));
- new szPrefix[64] = "^x04[VIP]";
- if(!equal(szTmp,"#Cstrike_Chat_All")){
- add(szTmp2, charsmax(szTmp2), "^x01");
- add(szTmp2, charsmax(szTmp2), szPrefix);
- add(szTmp2, charsmax(szTmp2), " ");
- add(szTmp2, charsmax(szTmp2), szTmp);
- }
- else{
- new szPlayerName[64];
- get_user_name(id, szPlayerName, charsmax(szPlayerName));
- get_msg_arg_string(4, szTmp, charsmax(szTmp));
- set_msg_arg_string(4, "");
- add(szTmp2, charsmax(szTmp2), "^x01");
- add(szTmp2, charsmax(szTmp2), szPrefix);
- add(szTmp2, charsmax(szTmp2), "^x03 ");
- add(szTmp2, charsmax(szTmp2), szPlayerName);
- add(szTmp2, charsmax(szTmp2), "^x01 : ");
- add(szTmp2, charsmax(szTmp2), szTmp)
- }
- set_msg_arg_string(2, szTmp2);
- return PLUGIN_CONTINUE;
- }
- stock registerCommands(const array[][], arraySize, function[])
- {
- #if !defined ForRange
- #define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++)
- #define ForArray(%1,%2) for(new %1 = 0; %1 < gSizeof %2; %1++)
- #endif
- new newCommand[33];
- ForRange(i, 0, arraySize - 1)
- {
- ForRange(j, 0, 1)
- {
- formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]);
- register_clcmd(newCommand, function);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement