Peršokti į turinį
  • ŽAIDIMAI
  • , ŽAIDIMAI
  • ŽAIDIMAI

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 5294 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Recommended Posts

sveiki,

1) noriu paprasyti scripto/filterscripto tokio

Sumappinau mexanikus ir pastaciau garaza ir noriu tokio scripto/filterscripto kad kai mexanikas su darbine/nuosava/ kito zmogaus masina uzvaro i garaza, masina taisosi panasiai kai yra sf/lv/ls mestuose autoservisai uz 100lt tai va.

2)Sumapinau teniso stala ir noriu padaryti filterscripta letuviska kaskoki pagrinda turiu. o stalo ar dar ko nors kordinates pazymekite nten pvz:*

#include 

#undef MAX_PLAYERS
#define MAX_PLAYERS 2

#define MSPERFRAME 50   //Milliseconds per frame

forward GameUpdate();

//TextDraws
new Text:Paddles[2];	//The paddles
new Text:Background;    //Black background to cover the screen
new Text:Net[4];        //The dotted line in the center
new Text:Score[2];      //The score on either side of the 'net'
new Text:Ball;          //The ball
new TextDrawsCreated;   //0/1 if textdraws are created already

//Variables
new Players[2];                     //Maximum of 2 players
new PaddlePositions[2];       		//The Y coordinate of the paddles (starting from the top)
new BallPosition[2];          		//The X,Y Coordinate of the ball
new BallVelocity[2];                //The velocity of the ball (-5 through 5, X/Y velocities)
new Bot[2];                         //0/1 if player is a bot
new GameTimer;
new GameRunning;
new SoundChange;
new GameScore[2];

//Functions
stock AffirmTextDraws()
{
if(TextDrawsCreated)return;

while(TextDrawCreate(0.0,0.0,"~R~")==Text:0)continue;

Background=TextDrawCreate(123,103,"~r~");
TextDrawUseBox(Background,1);
TextDrawBoxColor(Background,0x000000FF);
TextDrawTextSize(Background,520,0.0);
TextDrawLetterSize(Background,0,200*0.135);

Net[0]=TextDrawCreate(321,103,"~r~");
TextDrawUseBox(Net[0],1);
TextDrawBoxColor(Net[0],0xFFFFFFFF);
TextDrawTextSize(Net[0],322,0.0);
TextDrawLetterSize(Net[0],0,26.666*0.135);

Net[1]=TextDrawCreate(321,170,"~r~");
TextDrawUseBox(Net[1],1);
TextDrawBoxColor(Net[1],0xFFFFFFFF);
TextDrawTextSize(Net[1],322,0.0);
TextDrawLetterSize(Net[1],0,26.666*0.135);

Net[2]=TextDrawCreate(321,240,"~r~");
TextDrawUseBox(Net[2],1);
TextDrawBoxColor(Net[2],0xFFFFFFFF);
TextDrawTextSize(Net[2],322,0.0);
TextDrawLetterSize(Net[2],0,26.666*0.135);

Net[3]=TextDrawCreate(321,313.2,"~r~");
TextDrawUseBox(Net[3],1);
TextDrawBoxColor(Net[3],0xFFFFFFFF);
TextDrawTextSize(Net[3],322,0.0);
TextDrawLetterSize(Net[3],0,26.666*0.135);

Score[0]=TextDrawCreate(313,105,"0");
TextDrawColor(Score[0],0xFFFFFFFF);
TextDrawAlignment(Score[0],3);
TextDrawFont(Score[0],3);
TextDrawLetterSize(Score[0],0.5,15*0.135);
TextDrawSetShadow(Score[0],0);

Score[1]=TextDrawCreate(330,105,"0");
TextDrawColor(Score[1],0xFFFFFFFF);
TextDrawLetterSize(Score[1],0.5,15*0.135);
TextDrawFont(Score[1],3);
TextDrawSetShadow(Score[1],0);

Paddles[0]=TextDrawCreate(138,103,"~r~");
TextDrawUseBox(Paddles[0],1);
TextDrawBoxColor(Paddles[0],0xFFFFFFFF);
TextDrawTextSize(Paddles[0],139,0.0);
TextDrawLetterSize(Paddles[0],0,26.666*0.135);

Paddles[1]=TextDrawCreate(504,103,"~r~");
TextDrawUseBox(Paddles[1],1);
TextDrawBoxColor(Paddles[1],0xFFFFFFFF);
TextDrawTextSize(Paddles[1],505,0.0);
TextDrawLetterSize(Paddles[1],0,26.666*0.135);

Ball=TextDrawCreate(400,200,"~r~");
TextDrawUseBox(Ball,1);
TextDrawBoxColor(Ball,0xFFFFFFFF);
TextDrawTextSize(Ball,401,0.0);
TextDrawLetterSize(Ball,0,3*0.135);

TextDrawsCreated=1;
}

stock ShowPong(playerid)
{
TextDrawShowForPlayer(playerid,Paddles[0]);
TextDrawShowForPlayer(playerid,Paddles[0]);
TextDrawShowForPlayer(playerid,Paddles[1]);
TextDrawShowForPlayer(playerid,Paddles[1]);
TextDrawShowForPlayer(playerid,Background);
TextDrawShowForPlayer(playerid,Net[0]);
TextDrawShowForPlayer(playerid,Net[1]);
TextDrawShowForPlayer(playerid,Net[2]);
TextDrawShowForPlayer(playerid,Net[3]);
TextDrawShowForPlayer(playerid,Score[0]);
TextDrawShowForPlayer(playerid,Score[1]);
TextDrawShowForPlayer(playerid,Ball);
}

stock StartPong(player1,player2)
{
if(player1==INVALID_PLAYER_ID)Bot[0]=1;
else ShowPong(player1);
if(player2==INVALID_PLAYER_ID)Bot[1]=1;
else ShowPong(player2);
Players[0]=player1;
Players[1]=player2;
TogglePlayerControllable(player1,0);
TogglePlayerControllable(player2,0);
BallPosition[0]=200;
GameTimer=SetTimer("GameUpdate",MSPERFRAME,1);
GameRunning=1;
}

stock KillPong()
{
for(new i;i<2;i++)
{
	TextDrawDestroy(Paddles[i]);
	TextDrawDestroy(Score[i]);
}
for(new i;i<4;i++)TextDrawDestroy(Net[i]);
TextDrawDestroy(Background);
TextDrawDestroy(Ball);
KillTimer(GameTimer);
GameScore[0]=0;
GameScore[1]=0;
TogglePlayerControllable(Players[0],0);
TogglePlayerControllable(Players[1],0);
GameRunning=0;
TextDrawsCreated=0;
}

stock PositionObjects()
{
if(TextDrawsCreated)
{
    TextDrawDestroy(Paddles[0]);
    TextDrawDestroy(Paddles[1]);
    TextDrawDestroy(Ball);




	Paddles[0]=TextDrawCreate(138,103+PaddlePositions[0],"~r~");
	TextDrawUseBox(Paddles[0],1);
	TextDrawBoxColor(Paddles[0],0xFFFFFFFF);
	TextDrawTextSize(Paddles[0],139,0.0);
	TextDrawLetterSize(Paddles[0],0,26.666*0.135);

	Paddles[1]=TextDrawCreate(504,103+PaddlePositions[1],"~r~");
	TextDrawUseBox(Paddles[1],1);
	TextDrawBoxColor(Paddles[1],0xFFFFFFFF);
	TextDrawTextSize(Paddles[1],505,0.0);
	TextDrawLetterSize(Paddles[1],0,26.666*0.135);

	Ball=TextDrawCreate(123+BallPosition[0],103+BallPosition[1],"~r~");
	TextDrawUseBox(Ball,1);
	TextDrawBoxColor(Ball,0xFFFFFFFF);
	TextDrawTextSize(Ball,124+BallPosition[0],0.0);
	TextDrawLetterSize(Ball,0,2.5*0.135);

    ShowPong(Players[0]);
    ShowPong(Players[1]);

}
}

stock UpdateScore()
{
new tmp[5];
format(tmp,5,"%02d",GameScore[0]);
TextDrawSetString(Score[0],tmp);
format(tmp,5,"%02d",GameScore[1]);
TextDrawSetString(Score[1],tmp);
}

//Callbacks
public OnFilterScriptInit()
{
AffirmTextDraws();
}

public OnFilterScriptExit()
{
KillPong();
}

public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext,"/pong",true,5))
{
    if(GameRunning)return 1;
    if(strlen(cmdtext)<=6)StartPong(playerid,INVALID_PLAYER_ID);
    else StartPong(playerid,strval(cmdtext[6]));
    return 1;
}
return 0;
}
new GlobalTemp[3];
public GameUpdate()
{
switch(BallPosition[0])
{
    //Left Wall
    case 0:
	{
		BallVelocity[0]=random(5)+3;
		PlayerPlaySound(Players[0],1056,0,0,0);
		BallPosition[0]=200;
		GameScore[1]++;
		UpdateScore();
		CallLocalFunction("OnPlayerScore","i",1);
		if(!GameRunning)return;
	}
    //Right Wall
    case 396:
	{
		BallVelocity[0]=(-random(5))-3;
		PlayerPlaySound(Players[0],1056,0,0,0);
		BallPosition[0]=200;
		GameScore[0]++;
		UpdateScore();
		CallLocalFunction("OnPlayerScore","i",0);
		if(!GameRunning)return;
	}
    //Left Paddle
    case 18:
    {
        if( (BallPosition[1]<=PaddlePositions[0]+44) && (BallPosition[1]>=PaddlePositions[0]-4) )
        {
			BallVelocity[0]=random(5)+3;
			PlayerPlaySound(Players[0],1056+SoundChange,0,0,0);
			if(SoundChange)SoundChange=0;
			else SoundChange=1;
        }
    }
    //Right Paddle
    case 377:
    {
        if( (BallPosition[1]<=PaddlePositions[1]+44) && (BallPosition[1]>=PaddlePositions[1]-4) )
        {
			BallVelocity[0]=(-random(5))-3;
			PlayerPlaySound(Players[0],1056+SoundChange,0,0,0);
			if(SoundChange)SoundChange=0;
			else SoundChange=1;
        }
	}
}
//Roof
if(BallPosition[1]==0)
{
	//BallVelocity[1]=random(5)+2;
	BallVelocity[1]*=-1;
	PlayerPlaySound(Players[0],1056+SoundChange,0,0,0);
	if(SoundChange)SoundChange=0;
	else SoundChange=1;
}
//Floor
if(BallPosition[1]==240)
{
	//BallVelocity[1]=(-random(5))-2;
	BallVelocity[1]*=-1;
	PlayerPlaySound(Players[0],1056+SoundChange,0,0,0);
	if(SoundChange)SoundChange=0;
	else SoundChange=1;
}
if(BallVelocity[1]==0)BallVelocity[1]=(random(5)+2)*(random(1)-1);
if(BallVelocity[0]==0)BallVelocity[0]=(random(5)+2)*(random(1)-1);

//Player 1 Controls
if(Players[0]!=INVALID_PLAYER_ID)
{
	GetPlayerKeys(Players[0],GlobalTemp[0],GlobalTemp[1],GlobalTemp[2]);
	if(GlobalTemp[1]==KEY_UP)PaddlePositions[0]-=3;
	else if(GlobalTemp[1]==KEY_DOWN)PaddlePositions[0]+=3;
}else{
    //NPC controls
    if(BallPosition[1]>PaddlePositions[0]+3)PaddlePositions[0]+=3;
    else PaddlePositions[0]-=3;
}
//Player 2 Controls
if(Players[1]!=INVALID_PLAYER_ID)
{
	GetPlayerKeys(Players[1],GlobalTemp[0],GlobalTemp[1],GlobalTemp[2]);
	if(GlobalTemp[1]==KEY_UP)PaddlePositions[1]-=3;
	else if(GlobalTemp[1]==KEY_DOWN)PaddlePositions[1]+=3;
}else{
    //NPC controls
    if(BallPosition[1]>PaddlePositions[1]+3)PaddlePositions[1]+=3;
    else PaddlePositions[1]-=3;
}

//If ball is about to hit paddle's X coordinate, force it
if( ((BallPosition[0]-18)+BallVelocity[0]<0) && (BallPosition[0]>18) )BallPosition[0]=18;
else if( ((BallPosition[0]-377)+BallVelocity[0]>0) && (BallPosition[0]<377) )BallPosition[0]=377;
else BallPosition[0]+=BallVelocity[0];
//Adjust Balls Y coordinate
BallPosition[1]+=BallVelocity[1];

//Ball Limits
if(BallPosition[0]<0)BallPosition[0]=0;
if(BallPosition[0]>396)BallPosition[0]=396;
if(BallPosition[1]<0)BallPosition[1]=0;
if(BallPosition[1]>240)BallPosition[1]=240;
//Paddle Limits
if(PaddlePositions[0]>210)PaddlePositions[0]=210;
if(PaddlePositions[0]<0)PaddlePositions[0]=0;
if(PaddlePositions[1]>210)PaddlePositions[1]=210;
if(PaddlePositions[1]<0)PaddlePositions[1]=0;
//Update
PositionObjects();
}



//// OnPlayerScore callback


forward OnPlayerScore(player); //Player == 0 || 1 (1 and 2)
public OnPlayerScore(player)
{
if(GameScore[player]==15)   //Check to see if his score is high enough to win
{
	if(Players[player]!=INVALID_PLAYER_ID)   //Affirm that winner is not an NPC
	{
	    SendClientMessage(Players[player],0xFFFFFFFF,"You win! {00FF00}+$15");  //Winning message
	    GivePlayerMoney(Players[player],15);
	}
	new loser;
	if(player)loser=0;  //Get losing player
	else loser=1;
	if(Players[loser]!=INVALID_PLAYER_ID)   //Make sure loser is not an NPC
	{
	    SendClientMessage(Players[loser],0xFFFFFFFF,"You lose! {FF0000}-$15"); //Losing message
	    GivePlayerMoney(Players[loser],-15);
	}
	KillPong();   //Be sure to kill the game
}
}


Apsilankyk cia ir atsakyma parasyk i tema ar i PM

Jusu paciu naudai:)

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 5294 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Prisijungti prie diskusijos

Palikti atsakymą galite iš karto, o užsiregistruoti vėliau. Jeigu jau turite paskyrą mūsų forume, Prisijunkite.

Svečias
Atsakyti šioje temoje...

×   Įklijuotas tekstas turi teksto formatavimą.   Pašalinti teksto formatavimą

  Galimi tik 75 veidukai.

×   Nuoroda buvo automatiškai įterpta.   Įterpti nuorodą paprastai

×   Jūsų ankstesnis pranešimas buvo atkurtas.   Išvalyti redaktorių

×   Jūs negalite įkelti nuotraukas tiesiogiai.Įkelkite arba įdėkite nuotraukas iš URL.

  • Šiame puslapyje naršo:   0 nariai

    • Nėra registruotų narių peržiūrinčių šį forumą.

Skelbimai


×
×
  • Sukurti naują...