#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"
#define MYMENU_KEYS MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /rate","menu")
register_menu("FirstMenu",MYMENU_KEYS,"menu2");
}
public menu(id){
show_menu(id,MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4,"yRate Menu^n^nw1. +25^n2. +50^n3. +75^n4. +100",-1,"FirstMenu");
return PLUGIN_HANDLED;
}
public menu2(id,key)
{
switch(key)
{
case 0:
{
one(id);
}
case 1:
{
two(id);
}
case 2:
{
thre(id);
}
case 3:
{
four(id);
}
}
}
public one(id)
{
set_user_maxspeed(id,get_user_maxspeed(id)+25.0)
}
public two(id)
{
set_user_maxspeed(id,get_user_maxspeed(id)+50.0)
}
public three(id)
{
set_user_maxspeed(id,get_user_maxspeed(id)+75.0)
}
public four(id)
{
set_user_maxspeed(id,get_user_maxspeed(id)+100.0)
}
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.
|
Zmiana szybkosci poruszania gracza
#1
Napisano 24.08.2009 15:48
#2
Napisano 24.08.2009 15:50
#include <fun>Jeśli chcesz używać set_user_maxspeed.
#3
Napisano 24.08.2009 16:05
#4
Napisano 24.08.2009 16:23
Musisz pamiętać, że szybkość zmieni się na normalną po każdej zmianie broni (tak mi się wydaje
No i jeszcze cvar odpowiedzialny za maxymalną szybkość na serverze, sv_maxspeed.
Jeśli już masz zaincludowane engine, to możesz użyć (osobiście z tego korzystałem):
entity_set_float(id, EV_FL_maxspeed, 240.0)zamiast set_...
#5
Napisano 24.08.2009 16:30
#6
Napisano 24.08.2009 22:22
a co do broni to uzyj eventu
register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );i zmiennych w ktorych bedzie to, czy gracz ma wiekszego speeda. Jesli tak to w tym evencie ma przywrocic maxspeeda
a tak btw. (Nie chce zakladac kolejnego teamatu poniewaz jest prawie o tym samym
#7
Napisano 24.08.2009 22:45
set_cvar_string("sv_maxspeed", "350");i kompilator się nie doczepił do tego [ Dodano: 25-08-2009, 00:12 ]
dzięki wszystkim mam już swojego pierwszego pluga za sobą
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"
#define MYMENU_KEYS MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4
new one_cost
new two_cost
new three_cost
new four_cost
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /rate","menu")
register_menu("FirstMenu",MYMENU_KEYS,"menu2");
set_cvar_num("sv_maxspeed", 350);
one_cost = register_cvar("one_cost","2500")
two_cost = register_cvar("two_cost","5000")
three_cost = register_cvar("three_cost","7500")
four_cost = register_cvar("four_cost","10000")
}
public menu(id){
show_menu(id,MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4,"yRate Menu^n^nw1. +25^n2. +50^n3. +75^n4. +100",-1,"FirstMenu");
return PLUGIN_HANDLED
}
public menu2(id,key)
{
switch(key)
{
case 0:
{
one(id);
}
case 1:
{
two(id);
}
case 2:
{
three(id);
}
case 3:
{
four(id);
}
}
}
public one(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(one_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(one_cost))
set_user_maxspeed(id,250.0+25.0)
return PLUGIN_HANDLED
}
public two(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(two_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(two_cost))
set_user_maxspeed(id,250.0+50.0)
return PLUGIN_HANDLED
}
public three(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(three_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(three_cost))
set_user_maxspeed(id,250.0+75.0)
return PLUGIN_HANDLED
}
public four(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(four_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(four_cost))
set_user_maxspeed(id,250.0+100.0)
return PLUGIN_HANDLED
}
ale nie ma łatwiejszego sposobu na zmianę aktywnego slota
#8
Napisano 24.08.2009 23:54
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"
#define MYMENU_KEYS MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4
new speed_jest_na_runde = 1 // 1 - tak 0 - nie
new Float:speed[33]=250.0;
new one_cost
new two_cost
new three_cost
new four_cost
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );
register_logevent("Koniec_Rundy", 2, "1=Round_End")
register_clcmd("say /rate","menu")
register_menu("FirstMenu",MYMENU_KEYS,"menu2");
set_cvar_num("sv_maxspeed", 350);
one_cost = register_cvar("one_cost","2500")
two_cost = register_cvar("two_cost","5000")
three_cost = register_cvar("three_cost","7500")
four_cost = register_cvar("four_cost","10000")
}
public client_connect(id){
speed[id] = 250.0;
}
public Event_Change_Weapon(id){
set_user_maxspeed(id,speed[id])
}
public Koniec_Rundy(){
if(speed_jest_na_runde){
for(new id; id<33; id++){
if(is_user_connected(id)){
speed[id] = 250.0;
}
}
}
}
public menu(id){
show_menu(id,MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4,"yRate Menu^n^nw1. +25^n2. +50^n3. +75^n4. +100",-1,"FirstMenu");
return PLUGIN_HANDLED
}
public menu2(id,key)
{
switch(key)
{
case 0:
{
one(id);
}
case 1:
{
two(id);
}
case 2:
{
three(id);
}
case 3:
{
four(id);
}
}
}
public one(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(one_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(one_cost))
speed[id] = 250.0+25.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public two(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(two_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(two_cost))
speed[id] = 250.0+50.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public three(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(three_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(three_cost))
speed[id] = 250.0+75.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public four(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(four_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(four_cost))
speed[id] = 250.0+100.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
#9
Napisano 25.08.2009 01:59
co robią funkcje
register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );
register_logevent("Koniec_Rundy", 2, "1=Round_End")sprawdziłem na amxmodx.org ale nie zrozumiałem jak się one mają do zmiany broni i zakończenia rundy
#10
Napisano 25.08.2009 08:32
#11
Napisano 25.08.2009 08:41
register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );
register_logevent("Koniec_Rundy", 2, "1=Round_End")
#12
Napisano 25.08.2009 08:46
CurWeapon - nazwa eventa rozpoznawana przez amxx'aregister_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );
Event_Change_Weapon - nazwa funkcji ktora ma byc wywolana
be - flagi eventa
"a" - Global Event - wysylany do all graczy (mozliwy jest brak mozliwosci podpiecia id do eventu np. DeathMsg)
"b" - Event sent to a single target - do konkretnego gracza (zwiazany z pojedynczym graczem - demage)
"c" - Send only once when repeated to other players - tylko raz gdy jest powtarzany u innych graczy.
"d" - Only if sent to a dead player - tylko u martwych graczy
"e" - Only if sent to an alive player - tylko u zywych graczy ( przed wersja 1.80 jest bug, wiec i tak wypada sprawdzac is_user_alive(id) )
"1=1" - pierwszy parametr eventu jest rowny 1
#13
Napisano 25.08.2009 08:51
#14
Napisano 25.08.2009 08:57
#15
Napisano 25.08.2009 09:02
public client_connect(id){
speed[id] = 250.0;
}
#16
Napisano 25.08.2009 09:25
Raczej tu, a wszystkie 250 w kodzie moglbys zamienic na 1 #define i w razie potrzeby moglbys zmienic tylko w 1 miejscu a nie poprawiac caly plugpublic Event_Change_Weapon(id){
set_user_maxspeed(id,speed[id])
}
#17
Napisano 25.08.2009 09:40
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <cstrike>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Home"
#define MYMENU_KEYS MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4
new speed_jest_na_runde = 1 // 1 - tak 0 - nie
new Float:speed[33]=250.0;
new one_cost
new two_cost
new three_cost
new four_cost
new bron_id
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" );
register_logevent("Koniec_Rundy", 2, "1=Round_End")
register_clcmd("say /rate","menu")
register_menu("FirstMenu",MYMENU_KEYS,"menu2");
set_cvar_num("sv_maxspeed", 350);
one_cost = register_cvar("one_cost","2500")
two_cost = register_cvar("two_cost","5000")
three_cost = register_cvar("three_cost","7500")
four_cost = register_cvar("four_cost","10000")
}
public client_connect(id){
bron_id=cs_get_weapon_id(id)
switch(bron_id)
{
case 6:
case 4:
case 9:
case 25:
case 29:
case 1:
case 10:
case 11:
case 16:
case 17:
case 26:
case 23:
case 7:
case 19:
case 12:
{
speed[id] = 250.0
}
case 30:
{
speed[id] = 245.0
}
case 5:
case 15:
case 14:
case 8:
{
speed[id] = 240.0
}
case 27:
{
speed[id] = 235.0
}
case 21:
case 22:
{
speed[id] = 230.0
}
case 28:
case 20:
{
speed[id] = 220.0
}
case 13:
case 24:
case 18:
{
speed[id] = 210.0
}
}
return PLUGIN_HANDLED
}
}
public Event_Change_Weapon(id){
set_user_maxspeed(id,speed[id])
}
public Koniec_Rundy(){
if(speed_jest_na_runde){
for(new id; id<33; id++){
if(is_user_connected(id)){
speed[id] = 250.0;
}
}
}
}
public menu(id){
show_menu(id,MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4,"yRate Menu^n^nw1. +25^n2. +50^n3. +75^n4. +100",-1,"FirstMenu");
return PLUGIN_HANDLED
}
public menu2(id,key)
{
switch(key)
{
case 0:
{
one(id);
}
case 1:
{
two(id);
}
case 2:
{
three(id);
}
case 3:
{
four(id);
}
}
}
public one(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(one_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(one_cost))
speed[id] = get_user_maxspeed(id)+25.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public two(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(two_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(two_cost))
speed[id] = get_user_maxspeed(id)+50.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public three(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(three_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(three_cost))
speed[id] = get_user_maxspeed(id)+75.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}
public four(id)
{
if(is_user_alive(id)==0)
{
client_print(id,print_chat,"Nie żyjesz!")
return PLUGIN_HANDLED
}
if(cs_get_user_money(id)<=get_pcvar_num(four_cost))
{
client_print(id,print_chat,"Masz za mało kasy!")
return PLUGIN_HANDLED
}
cs_set_user_money(id,cs_get_user_money(id)-get_pcvar_num(four_cost))
speed[id] = get_user_maxspeed(id)+100.0;
set_user_maxspeed(id,speed[id])
return PLUGIN_HANDLED
}ale się nie kompiluje
#18
Napisano 25.08.2009 09:58
W tym miejscu:
switch(bron_id)
{
case 6:
case 4:kompilator oczekuje jakiejś akcji w wypadku 6-stki, a u Ciebie tą akcją jest case, więc wywala Ci błąd, że nie ma swicha do tego case.Więc albo wywal puste case-y, albo powstawiaj klamerki:
switch(bron_id)
{
case 6:
{
}
#19
Napisano 25.08.2009 10:08
#20
Napisano 25.08.2009 14:00
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych


Dodatki SourceMod



Temat jest zamknięty









