SA-MP Forums Archive
Help for one small thing.. :) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help for one small thing.. :) (/showthread.php?tid=374417)



Help for one small thing.. :) - Ruffian - 02.09.2012

I want to do when a player enters the server it comes to information, but not when writing the command "/info" until then!

Код:
#include <a_samp>
#include <time>

#define GREEN 				0x21DD00FF
#define RED 				0xE60000FF
#define ADMIN_RED 			0xFB0000FF
#define YELLOW 				0xFFFF00FF
#define ORANGE 				0xF97804FF
#define LIGHTRED 			0xFF8080FF
#define LIGHTBLUE 			0x00C2ECFF
#define PURPLE 				0xB360FDFF
#define PLAYER_COLOR 		0xFFFFFFFF
#define BLUE 				0x1229FAFF
#define LIGHTGREEN 			0x38FF06FF
#define DARKPINK 			0xE100E1FF
#define DARKGREEN 			0x008040FF
#define ANNOUNCEMENT 		0x00CACAFB
#define AFK 				0x6AF7E1FF
#define COLOR_SYSTEM 		0xEFEFF7AA
#define PLAYER_VIEW 		0xC0C0C0FF
#define COLOR_GRAD1 		0xB4B5B7FF
#define NICESKY 			0x99FFFFAA
#define GRAY 				0xCECECEFF
#define COLOR_BASIC 		0x0066FFAA
#define SITE                "gangstawar . ovo . bg"

#pragma tabsize 0

new bool:AGosterge[MAX_PLAYERS];
new bool:BilgiGosterge[MAX_PLAYERS];


new Text:ArkaPlan0;
new Text:ArkaPlan1;
new Text:ArkaPlan2;
new Text:ArkaPlan3;
new Text:ArkaPlan4;

new Text:Bilgi[MAX_PLAYERS];

new Inf[MAX_PLAYERS] = 0;
new INFO;

forward Info();


public OnFilterScriptInit()
{
	print("\n-----------------------------------------");
	print(" Mini Info Bar By [WsR]RyDeR - Loaded -");
	print("------------------------------------------\n");
	
	INFO = SetTimer("Info",900,1);
	
	ArkaPlan0 = TextDrawCreate(620.000000,327.000000,"_");
	ArkaPlan1 = TextDrawCreate(471.000000,329.000000,"_");
	ArkaPlan2 = TextDrawCreate(618.000000,409.000000,"_");
	ArkaPlan3 = TextDrawCreate(471.000000,329.000000,"_");
	ArkaPlan4 = TextDrawCreate(617.000000,329.000000,"_");
	TextDrawUseBox(ArkaPlan0,1);
	TextDrawBoxColor(ArkaPlan0,0x00000066);
	TextDrawTextSize(ArkaPlan0,465.000000,-2.000000);
	TextDrawUseBox(ArkaPlan1,1);
	TextDrawBoxColor(ArkaPlan1,0xffffffff);
	TextDrawTextSize(ArkaPlan1,614.000000,40.000000);
	TextDrawUseBox(ArkaPlan2,1);
	TextDrawBoxColor(ArkaPlan2,0xffffffff);
	TextDrawTextSize(ArkaPlan2,467.000000,160.000000);
	TextDrawUseBox(ArkaPlan3,1);
	TextDrawBoxColor(ArkaPlan3,0xffffffff);
	TextDrawTextSize(ArkaPlan3,468.000000,141.000000);
	TextDrawUseBox(ArkaPlan4,1);
	TextDrawBoxColor(ArkaPlan4,0xffffffff);
	TextDrawTextSize(ArkaPlan4,614.000000,150.000000);
	TextDrawAlignment(ArkaPlan0,0);
	TextDrawAlignment(ArkaPlan1,0);
	TextDrawAlignment(ArkaPlan2,0);
	TextDrawAlignment(ArkaPlan3,0);
	TextDrawAlignment(ArkaPlan4,0);
	TextDrawBackgroundColor(ArkaPlan0,0x000000ff);
	TextDrawBackgroundColor(ArkaPlan1,0x000000ff);
	TextDrawBackgroundColor(ArkaPlan2,0x000000ff);
	TextDrawBackgroundColor(ArkaPlan3,0x000000ff);
	TextDrawBackgroundColor(ArkaPlan4,0x000000ff);
	TextDrawFont(ArkaPlan0,3);
	TextDrawLetterSize(ArkaPlan0,6.499999,9.000002);
	TextDrawFont(ArkaPlan1,3);
	TextDrawLetterSize(ArkaPlan1,12.400001,-0.300000);
	TextDrawFont(ArkaPlan2,3);
	TextDrawLetterSize(ArkaPlan2,0.199999,-0.300000);
	TextDrawFont(ArkaPlan3,3);
	TextDrawLetterSize(ArkaPlan3,0.699999,8.499997);
	TextDrawFont(ArkaPlan4,3);
	TextDrawLetterSize(ArkaPlan4,-0.300000,8.499998);
	TextDrawColor(ArkaPlan0,0xffffffff);
	TextDrawColor(ArkaPlan1,0xffffffff);
	TextDrawColor(ArkaPlan2,0xffffffff);
	TextDrawColor(ArkaPlan3,0xffffffff);
	TextDrawColor(ArkaPlan4,0xffffffff);
	TextDrawSetOutline(ArkaPlan0,1);
	TextDrawSetOutline(ArkaPlan1,1);
	TextDrawSetOutline(ArkaPlan2,1);
	TextDrawSetOutline(ArkaPlan3,1);
	TextDrawSetOutline(ArkaPlan4,1);
	TextDrawSetProportional(ArkaPlan0,1);
	TextDrawSetProportional(ArkaPlan1,1);
	TextDrawSetProportional(ArkaPlan2,1);
	TextDrawSetProportional(ArkaPlan3,1);
	TextDrawSetProportional(ArkaPlan4,1);
	TextDrawSetShadow(ArkaPlan0,1);
	TextDrawSetShadow(ArkaPlan1,1);
	TextDrawSetShadow(ArkaPlan2,1);
	TextDrawSetShadow(ArkaPlan3,1);
	TextDrawSetShadow(ArkaPlan4,1);
	return 1;
}

public OnFilterScriptExit()
{
   	print("\n-----------------------------------------");
	print(" Mini Info Bar By [WsR]RyDeR - Unloaded -");
	print("------------------------------------------\n");
	
	KillTimer(INFO);
	
 	TextDrawDestroy(Text:ArkaPlan0);
	TextDrawDestroy(Text:ArkaPlan1);
	TextDrawDestroy(Text:ArkaPlan2);
	TextDrawDestroy(Text:ArkaPlan3);
	TextDrawDestroy(Text:ArkaPlan4);
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		TextDrawDestroy(Text:Bilgi[i]);
	}
	return 1;
}

public Info()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && Inf[i] == 1) 
		{
			if(AGosterge[i] == false)
			{
				    TextDrawShowForPlayer(i, Text:ArkaPlan0);
				    TextDrawShowForPlayer(i, Text:ArkaPlan1);
				    TextDrawShowForPlayer(i, Text:ArkaPlan2);
				    TextDrawShowForPlayer(i, Text:ArkaPlan3);
				    TextDrawShowForPlayer(i, Text:ArkaPlan4);
				    AGosterge[i] = true;
			}
			
			new tmp[265]; new saat, dkk, saniye; new Para; new Skor; new IP[MAX_PLAYERS]; new Isimi[MAX_PLAYER_NAME]; new Ping;
		 	gettime(saat, dkk, saniye);
		 	Para = GetPlayerMoney(i);
		 	Skor = GetPlayerScore(i);
		 	Ping = GetPlayerPing(i);
			GetPlayerName(i,Isimi, sizeof(Isimi));
		 	GetPlayerIp(i, IP, sizeof(IP));

			if(BilgiGosterge[i] == true)
			{
				TextDrawDestroy(Bilgi[i]);
			}

			format(tmp, sizeof(tmp), "~p~Time: ~w~%d:%d:%d~n~~g~~h~Money: ~w~%d$~n~~b~~h~Score: ~w~%d~n~~r~~h~IP: ~w~%s~n~~y~Playerid: ~w~%d~n~~p~~h~Ping: ~w~%d~n~~r~%s",saat, dkk, saniye, Para,Skor,IP,i,Ping,SITE);

			Bilgi[i] = TextDrawCreate(474.000000,332.000000,tmp);
			TextDrawAlignment(Bilgi[i],0);
			TextDrawBackgroundColor(Bilgi[i],0x000000ff);
			TextDrawFont(Bilgi[i],2);
			TextDrawLetterSize(Bilgi[i],0.299999,1.100000);
			TextDrawColor(Bilgi[i],0x00ffffff);
			TextDrawSetProportional(Bilgi[i],1);
			TextDrawSetShadow(Bilgi[i],1);
  			TextDrawShowForPlayer(i, Bilgi[i]);
           	BilgiGosterge[i] = true;
			}
			else 
			{
				if(AGosterge[i] == true)
			    {
					TextDrawHideForPlayer(i, Text:ArkaPlan0);
				    TextDrawHideForPlayer(i, Text:ArkaPlan1);
					TextDrawHideForPlayer(i, Text:ArkaPlan2);
	 				TextDrawHideForPlayer(i, Text:ArkaPlan3);
	 				TextDrawHideForPlayer(i, Text:ArkaPlan4);
					AGosterge[i] = false;
				}TextDrawHideForPlayer(i, Text:Bilgi[i]);
		} 			
	}
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/info", false, 7) == 0)
	{
	    if(Inf[playerid] == 0)
	    {
		Inf[playerid] = 1;
		SendClientMessage(playerid, LIGHTGREEN, "[Info] The Info bar has been enabled.");
	    }
	    else if(Inf[playerid] == 1)
	    {
   		Inf[playerid] = 0;
		SendClientMessage(playerid, ADMIN_RED, "[Info] The Info bar has been disabled.");
	    }
	    return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}



Re: Help for one small thing.. :) - Misiur - 02.09.2012

Dude, are you stoned? I can't understand you at all


Re: Help for one small thing.. :) - Ruffian - 02.09.2012

Little Normal script is like you go to the game and show you info box. You can write /info and only then to show. I want when it comes to player server info box it came without writing the command "/info".Ok?


Re: Help for one small thing.. :) - Misiur - 02.09.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    Inf[playerid] = 1;
    return 1;
}