W czym rzecz? Cały czas powtarza mi się pewny fragment kodu i wiem, że da się to skrócić.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "Interp Menu"
#define VERSION "1.0"
#define AUTHOR "Vertricus"
#define Keysinterpowo (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4) // Keys: 12345
new interp[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menucmd(register_menuid("interpowo"), Keysinterpowo, "Pressedinterpowo")
RegisterHam(Ham_Spawn, "player", "spawn", 1);
// Add your code here...
}
public client_disconnect(id)
{
interp[id]=0
}
public client_connect(id)
{
interp[id]=0
}
public spawn(id)
{
set_task(5.0, "interpownik", id)
}
public interpownik(id)
{
if (interp[id] == 0) Showinterpowo(id)
else if (interp[id] == 1)
{
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.01")
}
else if (interp[id] == 2)
{
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.02")
}
else if (interp[id] == 3)
{
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.03")
}
else if (interp[id] == 4)
{
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.04")
}
else if (interp[id] == 5)
{
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.05")
}
}
public Showinterpowo(id) {
show_menu(id, Keysinterpowo, "Wybierz swoj interp:^n1. 0r.01^nw2. 0r.02^nw3. 0r.03^nw4. 0r.04^nw5. 0r.05^n", -1, "interpowo") // Display menu
}
public Pressedinterpowo(id, key) {
switch (key) {
case 0: { // 1
client_print(id, print_chat, "[EXTREME-SERWER.PL] Interp ustawiony.")
interp[id]=1
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.01")
}
case 1: { // 2
client_print(id, print_chat, "[EXTREME-SERWER.PL] Interp ustawiony.")
interp[id]=2
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.02")
}
case 2: { // 3
client_print(id, print_chat, "[EXTREME-SERWER.PL] Interp ustawiony.")
interp[id]=3
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.03")
}
case 3: { // 4
client_print(id, print_chat, "[EXTREME-SERWER.PL] Interp ustawiony.")
interp[id]=4
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.04")
}
case 4: { // 5
client_print(id, print_chat, "[EXTREME-SERWER.PL] Interp ustawiony.")
interp[id]=5
console_cmd (id,"cl_updaterate 101")
server_cmd("wait")
console_cmd (id,"ex_interp 0.05")
}
}
}


Dodatki SourceMod



Temat jest zamknięty









