[Tutorial] Player random

Tutoriale scripting, cod si portiuni de cod.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

User avatar
Truth*
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 0
Joined: 11 Oct 2013, 11:08
Detinator Steam: Da
SteamID: Ezeru
Reputatie: Fost moderator ajutator
Membru Club eXtreamCS (4 luni)
Nume anterior: HyperioN.
Scripter eXtreamCS
0.2 / 3
Fond eXtream: 0
Location: Sibiu
Has thanked: 44 times
Been thanked: 122 times

17 Jan 2014, 16:17

Poftim incearca asa:
Sursa | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <ColorChat>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_logevent( "EventNewRoundStart", 2, "1=Round_Start" );
	// Add your code here...
}

public EventNewRoundStart(  ) {
	
	new iPlayers  [  32  ] , iNum, iNum2, iPlayers2 [ 32 ];
	get_players  (  iPlayers, iNum, "CT"  );
	get_players  (  iPlayers2, iNum2, "TERRORIST"  );
	
	for  (  new i = 0; i < iNum; i++  )  {
		
		CTCMD ( iPlayers [ i ] );
		
	}
	
	for  (  new k = 0; k < iNum2; k++  )  {
		
		TeroristCMD( iPlayers2 [ k ] );
		
	}
	

}

public CTCMD  ( id )  {
	
	new iplayers  [  32  ], count;  
	get_players  (  iplayers, count, "CT"  );  
	
	if  (  count  )  {
		new id = iplayers  [  random  (  count  )   ]
		
		//Mesaj
		new szName[ 32 ];
		get_user_name(id, szName, 31 );
		ColorChat(id, GREEN, "Felicitari %s din toti Teroristi tu ai fost ales sa salvezi lumea.", szName );
	}
}


public TeroristCMD ( id ) {
	
	
	new iplayers2 [  32  ] , count;   
	get_players (  iplayers2, count, "TERRORIST" );
	
	if  (  count  )  {
		new id = iplayers2  [  random  (  count  )   ]
		
		
		//Mesaj
		new szName[ 32 ];
		get_user_name(id, szName, 31 );
		ColorChat(id, GREEN, "Felicitari %s din toti Teroristi tu ai fost ales sa salvezi lumea.", szName );
		
	}
	
}
P.S.: Netestat = Nu am avut timp să mă uit atent peste cod. Deci ceea ce am scris este posibil să fie greşit sau să aibă erori.

If i helped you and you wanna thank me, you can donate at this link : here
This will motivate me to help you in the future.
[If you want a private plugin send me a PM.(No complex plugins please, I am a student and I don't have the time to make those)]
RoyalServer 2
User avatar
Hades Ownage
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 22 Oct 2008, 10:12
Detinator Steam: Da
Detinator server CS: jb.clutch.ro
SteamID: hades-source
Reputatie: Fost Super Moderator
Fost Scripter eXtreamCS
Nume anterior: hadesownage
Location: Iasi
Has thanked: 324 times
Been thanked: 406 times

17 Jan 2014, 16:57

Codul lui @Cs_SURV!V0R este corect, deci va functiona. Al lui @adventx n-o sa mearga.
Cosmin
Fost moderator
Fost moderator
Posts: 0
Joined: 06 Jul 2013, 22:08
Detinator Steam: Da
Detinator server CS: Nu
Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn
Has thanked: 492 times
Been thanked: 547 times

17 Jan 2014, 19:26

Al lu' adventx e normal sa nu mearga fiindca el a folosit odata functia si nu poate sa ia 2 random deodata..
User avatar
Adventx
Membru, skill 0
Membru, skill 0
Posts: 0
Joined: 17 Sep 2013, 21:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 128 times
Been thanked: 142 times
Contact:

17 Jan 2014, 19:46

Hades Ownage wrote:Codul lui @Cs_SURV!V0R este corect, deci va functiona. Al lui @adventx n-o sa mearga.
Scuzati dara :">
Post Reply

Return to “Scripting”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests