Search the Community
Showing results for tags 'amx mod x'.
-
In this topic, I'll post some codes I'll create for you to understand how this language works. (NOTE: These codes might not work as intended and might need some changes!) 1. This plugin will allow players to initiate a duel with one another using the "/duel" command. They can choose from four different weapons: knife, deagle, AK47, and AWP. If a player does not specify a target for the duel, the duel will be initiated with themselves. The plugin will then teleport the players to a platform where they can fight with their chosen weapon. The platform is located 128 units away from each player, and each player is facing the other. The plugin also disables rendering for the players, which makes them invisible to other players during the duel. #include < amxmodx > #include < amxmisc > new const DuelWeapon[][32] = { "Knife", "Deagle", "AK47", "AWP" }; public plugin_init() { register_plugin("Duel Plugin", "1.0", "Your Name"); register_clcmd("duel", "Start a duel", "duel <weapon> <player>", 1); } public client_cmd(id, cmd[]) { if(!equali(cmd, "duel", strlen(cmd))) { return PLUGIN_CONTINUE; } new weapon, target; if(sscanf(get_arg(1, cmd), "%d", weapon) != 1) { return PLUGIN_CONTINUE; } if(sscanf(get_arg(2, cmd), "%d", target) != 1) { target = id; } new weaponName[32]; format(weaponName, sizeof(weaponName), "Duel with %s", DuelWeapon[weapon]); new Float:origin1[3], origin2[3]; get_user_origin(id, origin1); get_user_origin(target, origin2); origin1[2] += 64.0; origin2[2] += 64.0; new Float:angles1[3], angles2[3]; get_user_angles(id, angles1); get_user_angles(target, angles2); new Float:forward1[3], forward2[3], right1[3], right2[3], up1[3], up2[3]; angle_vectors(angles1, forward1, right1, up1); angle_vectors(angles2, forward2, right2, up2); new Float:distance = 128.0; new Float:offset1[3], offset2[3]; vector_scale(forward1, -distance, offset1); vector_scale(forward2, distance, offset2); new Float:final1[3], final2[3]; vector_add(origin1, offset1, final1); vector_add(origin2, offset2, final2); teleport(id, final1, angles1); teleport(target, final2, angles2); set_user_rendering(id, kRenderFxNone, 0); set_user_rendering(target, kRenderFxNone, 0); message_begin(MSG_ONE, get_user_msgid(id, 1), _, id); write_byte(6); write_byte(0); write_short(1); message_end(); message_begin(MSG_ONE, get_user_msgid(target, 1), _, target); write_byte(6); write_byte(0); write_short(1); message_end(); } public plugin_end() { unregister_clcmd("duel"); }
ABOUT LEAKS COMMUNITY
LEAKS.RO is a resource community where aspiring webmasters can share content and receive support for a wide variety of software platforms — no license required.