Jump to content
Sign in to follow this  
Destroyer

[ZP 4.3/ZPA] Jak dodać ruletkę/koło potępionych

Recommended Posts

Jest to przykład ruletki, każda ruletkę można dostosować pod własne upodobania, ja działałem na gotowej ruletce ze starego swojego zp_expmoda.


Pod #define piszemy
 

new ruletka[33]


Robimy sobie enter i piszemy

new kolo1[] = "zombie_plague/ludacrisskill.wav", kolo2[] = "zombie_plague/holyshit.wav", kolo3[] = "zombie_plague/wickedsick.wav"


 
 
W public plugin_init rejestrujemy nową komendę

register_clcmd("say /kolo","ruletka_los")

 
 
W public plugin_precache dodajemy 

precache_sound(kolo1)
precache_sound(kolo2)
precache_sound(kolo3)


 
 
Rejestrujemy nową funkcję

public ruletka_los(id)
{
	if(ruletka[id]==0)
	{
	ColorChat(id, RED, "[Kolo Potepionych]^x01 Aby zagrac w kole musisz najpierw wykupic umiejetnosc. Wpisz ^x04/skille^x01 (3000 EXP).")
	return
	}

	if(!is_user_alive(id))
	{	
	ColorChat(id, RED, "[Kolo Potepionych]^x01 Musisz byc zywy, aby zagrac w kole!")
	return
	}

	if(zp_get_user_ammo_packs(id)<5)
	{
	ColorChat(id, RED, "[Kolo Potepionych]^x01 Potrzebujesz^x04 5 ammo pakow^x01 aby zaczac gre w Kole.")
	return
	}
		

	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - 5) 
	ColorChat(id, GREEN, "[Kolo Potepionych]^x01 Pobrano^x04 5 ammo pakow.^x01 Oby dopisalo Ci szczescie...")
	set_task(5.0,"ruletka_wynik", id)
}

public ruletka_wynik(id)
{
	new liczba
	liczba = random_num(1,999)

	new id_name[64]
	get_user_name(id,id_name,charsmax(id_name))

	switch(liczba)
	{
	case 1..600:
		{
		ColorChat(id, GREEN, "[Kolo Potepionych]^x01 Tym razem nie udalo Ci sie nic wygrac!")
		}
	case 601..640:
		{
		user_kill(id, 1)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 zostal zabity przez demony!",id_name)		
		}
	case 641..680:
		{	
			if(zp_get_user_last_human(id) || zp_get_user_last_zombie(id))
			{
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+15)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 15 ammo pakow!",id_name)
			return
			}

			if(!zp_get_user_zombie(id))
			{	
			zp_infect_user(id)
			ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 zostal zamieniony w zombi!",id_name)	
			}
			else
			{
			zp_disinfect_user(id)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 zostal zamieniony w czlowieka!",id_name)	
			}	
		}
	case 681..685:
		{
		OdejmijExp(id,2000)
		client_cmd(0,"speak %s",kolo2) 
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 2000 EXPa^x01!",id_name)
		}
	case 686..700:
		{
		OdejmijExp(id,1000)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 1000 EXPa!",id_name)
		}
	case 701..720:
		{
		OdejmijExp(id,200)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 200 EXPa!",id_name)
		}
	case 721..725:
		{
		DajExp(id,2500)
		client_cmd(0,"speak %s",kolo3) 
		ColorChat(0,GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 2500 EXPa!",id_name)
		}
	case 726..740:
		{
		DajExp(id,1250)
		ColorChat(0,GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 1250 EXPa!",id_name)
		}
	case 741..760:
		{
		DajExp(id,300)
		ColorChat(0,GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 300 EXPa!",id_name)
		}
	case 761..765:
		{
		zp_set_user_ammo_packs(id, 0)
		client_cmd(0,"speak %s",kolo2) 
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil wszystkie^x01 ammo paki!",id_name)
		}
	case 766..775:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)-25)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 25 ammo pakow!",id_name)
		}
	case 776..790:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)-10)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 10 ammo pakow!",id_name)		
		}
	case 791..795:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+60)
		client_cmd(0,"speak %s",kolo3) 
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 60 ammo pakow!",id_name)		
		}
	case 796..810:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+30)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 30 ammo pakow!",id_name)
		}
	case 811..830:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+20)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 20 ammo pakow!",id_name)
		}
	case 831..835:
		{
		zp_make_user_nemesis(id)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 zostal zamieniony w nemesisa!",id_name)	
		}
	case 836..840:
		{
		zp_make_user_survivor(id)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 zostal zamieniony w survivora!",id_name)
		}
	case 841..845:
		{
			if(!zp_get_user_zombie(id))
			{
			fm_set_user_health(id, pev(id, pev_health) + 500)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x01 Czlowiek ^x03%s^x01 wygral 500 HP!",id_name)
			}
			else
			{
			fm_set_user_health(id, pev(id, pev_health) + 10000)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x01 Zombi ^x03%s^x01 Wygral 10000 HP!",id_name)
			}
		}
	case 846..850:
		{
		fm_set_user_health(id, 1)
		ColorChat(0, RED, "[Kolo Potepionych]^x01 HP^x03 %s^x01 zostalo obnizone do 1!",id_name)	
		}
	case 851..855:
		{
		set_user_gravity(id,0.2)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral niska grawitacje!",id_name)
		}
	case 856..860:
		{
		set_user_gravity(id,2.5)
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 wygral ciezar slonia, nie moze skakac!",id_name)
		}
	case 861..865:
		{
		set_user_rendering(id,kRenderFxNone,255,255,255,kRenderTransAlpha,1)
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral calkowita niewidzialnosc!",id_name)
		}
	case 866..870:
		{
		set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue)+250, 250)))
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 otrzymal 250 punktow kamizelki!",id_name)		
		}
	case 871..875:
		{
			if(level[id]<=50)
			{
			DajExp(id,exp[level[id]]-player_xp_all[id])
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 1 poziom w gore!",id_name)
			}
			else
			{
			DajExp(id,5250)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 5250 expa!",id_name)
			client_cmd(0,"speak %s",kolo3) 
			}
		}
	case 876..880:
		{
			if(!zp_get_user_zombie(id))
			{
			zp_set_user_model(id, "zombie_chinese")
			ColorChat(id, GREEN, "[Kolo Potepionych]^x01 Wygrales kamuflaz zombi!")
			}
			else
			{
			zp_set_user_model(id, "vip")
			ColorChat(id, GREEN, "[Kolo Potepionych]^x01 Wygrales kamuflaz czlowieka!")
			}

			ColorChat(0, GREEN, "[Kolo Potepionych]^x01 W waszych szeregach jest infiltrator!")
		}
	case 881..885:
		{
			if(zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))
			{
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+12)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 12 ammo pakow!",id_name)		
			}
			else
			{
			engclient_cmd(id, "drop")
			give_item(id, "weapon_g3sg1")
			give_item(id,"ammo_762nato")
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral G3SG1!",id_name)
			}
		}
	case 886..890:
		{
			if(zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))
			{
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+12)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 12 ammo pakow!",id_name)		
			}
			else
			{
			engclient_cmd(id, "drop")
			give_item(id, "weapon_sg550")
			give_item(id,"ammo_556nato")
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral SG550!",id_name)
			}
		}
	case 891..900:
		{
			if(zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))
			{
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+10)
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 10 ammo pakow!",id_name)		
			}
			else
			{
			engclient_cmd(id, "drop")
			give_item(id, "weapon_m249")
			give_item(id,"ammo_556natobox")
			ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral M249!",id_name)
			}
		}
	case 901..905:	
		{
		fm_strip_user_weapons(id)
		give_item(id, "weapon_knife")
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 zostal ogolocony ze wszystkich broni!",id_name)
		}
	case 906..907:
		{
		DajExp(id,5000)
		client_cmd(0,"speak %s",kolo1) 
		ColorChat(0,GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 5000 EXPa!",id_name)
		}
	case 908:
		{
		OdejmijExp(id,3500)
		client_cmd(0,"speak %s",kolo2) 
		ColorChat(0, RED, "[Kolo Potepionych]^x03 %s^x01 stracil 3500 EXPa!",id_name)
		}
	case 909..996:
		{
		ColorChat(id, GREEN, "[Kolo Potepionych]^x01 Bylo blisko, sprobuj ponownie!")
		}
	case 997:
		{
		DajExp(id,8000)
		client_cmd(0,"speak %s",kolo1) 
		ColorChat(0,GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 8000 EXPa!",id_name)
		}
	case 998..999:
		{
		zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id)+100)
		client_cmd(0,"speak %s",kolo1) 
		ColorChat(0, GREEN, "[Kolo Potepionych]^x03 %s^x01 wygral 100 ammo pakow!",id_name)
		}	
	}
}

W public skille_menu dodajemy
 

format(formats,charsmax(formats),"\yKolo Potepionych \w[\r3000 Exp\w] Dostep: \r%d",ruletka[id])
menu_additem(menu,formats)

 
W public skille_menu2 dodajemy

format(formats,charsmax(formats),"\yKolo Potepionych \w[\r3000 Exp\w] Dostep: \r%d",ruletka[id])
menu_additem(menu,formats)

 
W public skille_menu_handle dodajemy
 
 

case 4:
		{
			if(ruletka[id]==1){
			ColorChat(id, GREEN, "[ZP]^x01 Juz wykupiles mozliwosc gry w Kole Potepionych!")
			skille_menu2(id)
			return PLUGIN_HANDLED
			}

			if(3000 > player_xp[id]){
				skille_menu2(id)
				menu_destroy(menu)
				return PLUGIN_HANDLED
			}
			player_xp[id]-=3000
			ColorChat(id, GREEN, "[ZP]^x01 Wykupiles mozliwosc gry w Kole Potepionych!")
			ruletka[id]++
			skille_menu2(id)
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}

W public skille_menu_handle2 dodajemy

case 4:
		{
			if(ruletka[id]==1){
			ColorChat(id, GREEN, "[ZP]^x01 Juz wykupiles mozliwosc gry w Kole Potepionych!")
			skille_menu2(id)
			return PLUGIN_HANDLED
			}

			if(3000 > player_xp[id]){
				skille_menu2(id)
				menu_destroy(menu)
				return PLUGIN_HANDLED
			}
			player_xp[id]-=3000
			ColorChat(id, GREEN, "[ZP]^x01 Wykupiles mozliwosc gry w Kole Potepionych!")
			ruletka[id]++
			skille_menu2(id)
			menu_destroy(menu)
			return PLUGIN_HANDLED
		}

W public reset dodajemy

health[id] = 0
	if(ruletka[id]==1){
		exp+=3000
	}
	ruletka[id] = 0

W public staty dodajemy

if(ruletka[id]==1)
	{
	formatex(tempstring,charsmax(tempstring),"<b>Mozliwosc gry w Kole Potepionych:<font color=#99FF33> Tak</font></b><br />")
	}
	else
	{
	formatex(tempstring,charsmax(tempstring),"<b>Mozliwosc gry w Kole Potepionych:<font color=#FFFF99> Nie</font></b><br />")
        }   

W public wyswietl_staty dodajemy
 
 

if(ruletka[player]==1)
	{
	formatex(tempstring,charsmax(tempstring),"<b>Mozliwosc gry w Kole Potepionych:<font color=#99FF33> Tak</font></b><br />")
	}
	else
	{
	formatex(tempstring,charsmax(tempstring),"<b>Mozliwosc gry w Kole Potepionych:<font color=#FFFF99> Nie</font></b><br />")
	}

W public client_authorized dodajemy

ruletka[id] = 0


 
W public wczytaj_exp dodajemy

ruletka[id] = str_to_num(szesc)


 
 
 
Poradnik mojego autorstwa.
Sposobów na dodanie ruletki jest kilka.
 
 
W następnym poradniku napisze jak dodać exp za hs i inne.

Edited by Destroyer
  • Like 1

Share this post


Link to post
Share on other sites

Fajne, po mimo tego, że nie gram na ZM, ani się nie zajmuję ZM to mi się podoba, gdybym mógł to wgrałbym to na swój serwer xD. Co więcej plugin twojego autorstwa to się chwali #good_job #my_respect :D 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Guidelines