[HELP] Rank system
#1

Hello, when you killed a player or when you die, do not frag and death, where is the problem?

Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#include <a_samp>
#include <dini>
new Text:R_1[MAX_PLAYERS],Text:Stats[MAX_PLAYERS];

#define COLOR_YELLOW 			0xFFFF00AA
#define COLOR_PINK     			0xFF66FFAA
#define COLOR_AQUA     			0x7CFC00AA
#define COLOR_WHITE 			0xFFFFFFAA
#define Ranks                   353
new Kills[MAX_PLAYERS],Deaths[MAX_PLAYERS];

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Lygiu sistema");
	print("--------------------------------------\n");

	if(!dini_Exists("Deaths.cfg"))
	{
	  dini_Create("Deaths.cfg");
	}

	if(!dini_Exists("Kills.cfg"))
	{
	  dini_Create("Kills.cfg");
	}


	return 1;
}

public OnFilterScriptExit()
{
	printf("*** Lygiu sistema *** ");

	return 1;
}




public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{

    new Pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Pname, MAX_PLAYER_NAME);
 	Deaths[playerid] = dini_Int("Deaths.cfg", Pname);
 	Kills[playerid] = dini_Int("Kills.cfg", Pname);
	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,Name,sizeof(Name));
	R_1[playerid] = TextDrawCreate(498.000000, 115.000000, " ");
	TextDrawBackgroundColor(R_1[playerid], 255);
	TextDrawFont(R_1[playerid], 1);
	TextDrawLetterSize(R_1[playerid], 0.250000, 0.899999);
	TextDrawColor(R_1[playerid], -1);
	TextDrawSetOutline(R_1[playerid], 0);
	TextDrawSetProportional(R_1[playerid], 1);
	TextDrawSetShadow(R_1[playerid], 1);

	Stats[playerid] = TextDrawCreate(498.000000, 125.000000, "~r~Nuzudymai: ~w~0 ~g~Mirtys: ~w~0");
	TextDrawBackgroundColor(Stats[playerid], 255);
	TextDrawFont(Stats[playerid], 1);
	TextDrawLetterSize(Stats[playerid], 0.250000, 0.899999);
	TextDrawColor(Stats[playerid], -1);
	TextDrawSetOutline(Stats[playerid], 0);
	TextDrawSetProportional(Stats[playerid], 1);
	TextDrawSetShadow(Stats[playerid], 1);



	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

	new Pname[MAX_PLAYER_NAME];
  	GetPlayerName(playerid, Pname, MAX_PLAYER_NAME);
  	dini_IntSet("Deaths.cfg", Pname, Deaths[playerid]);
  	dini_IntSet("Kills.cfg", Pname, Kills[playerid]);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	TextDrawShowForPlayer(playerid,Text:Stats[playerid]);
	TextDrawShowForPlayer(playerid,Text:R_1[playerid]);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	Kills[killerid]++;
	Deaths[playerid]++;
	return 1;
}

dcmd_rank( playerid, params[] )
{
	new id;
	if (strlen(params))
	{
	    id = strval(params);
	    if(IsPlayerConnected(id))
	    {
			new str[256];

			SendClientMessage(playerid,COLOR_YELLOW,"[FunZoneLT]>> Dabartinis lygis:");
			GetPlayerRank(playerid);
			format(str,sizeof(str),"[FunZoneLT]>> Nuzudymai: %d  Mirtys: %d ",GetPlayerKills(playerid),GetPlayerDeaths(playerid));
			SendClientMessage(playerid,0x00FF00AA,str);


	    }
	    else
	    {
	        SendClientMessage(playerid,0x00FF00AA, "[FunZoneLT]>> Tokio zaidejo nera.");
	    }
	}
	else
	{
	SendClientMessage(playerid,0x00FF00AA, "[FunZoneLT]>> /rank [zaidejoid]");

	}
	return 1;
}
dcmd_ranks( playerid, params[])
{
	#pragma unused params
    ShowPlayerDialog(playerid,Ranks,DIALOG_STYLE_MSGBOX,"{A3E4FF}Lygiai","1 Levelis 0-10\n2 Levelis 10-75\n3 Levelis 75-150\n4 Levelis 150-300\n5 Levelis 300-450\n6 Levelis 450-675\n7 Levelis 675-1000\n\
	 8 Levelis 1000-1500\n9 Levelis 1500-2250\n10 Levelis 2250-3375\n11 Levelis 3375-5100\n12 Levelis 5100-7650\n13 Levelis 7650-11475\n14 Levelis 11475-17500\n15 Levelis 17500-26250\n16 Levelis 26250-39375\n17 Levelis 39375-60000\n18 Levelis 60000-100000\n19 Levelis 100000 +","Gerai","");
	return 1;
}
public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(rank,4,cmdtext);
	dcmd(ranks,5,cmdtext);

	return 0;
}


GetPlayerRank(playerid)
{

    if(Kills[playerid]<10)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 1 Levelis.");
	}
	else if(Kills[playerid]>10 && Kills[playerid]<=75)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 2 Levelis.");
	}
	else if(Kills[playerid]>75 && Kills[playerid]<=150)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 3 Levelis.");
	}
	else if(Kills[playerid]>150 && Kills[playerid]<=300)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 4 Levelis.");
	}
	else if(Kills[playerid]>300 && Kills[playerid]<=450)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 5 Levelis.");
	}
	else if(Kills[playerid]>450 && Kills[playerid]<= 675)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 6 Levelis.");
	}
	else if(Kills[playerid]>675 && Kills[playerid]<= 1000)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 7 Levelis.");
	}
	else if(Kills[playerid]>1000 && Kills[playerid]<= 1500)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 8 Levelis.");
	}
	else if(Kills[playerid]>1500 && Kills[playerid]<= 2250)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 9 Levelis.");
	}
	else if(Kills[playerid]>2250 && Kills[playerid]<= 3375)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 10 Levelis.");
	}
	else if(Kills[playerid]>3375 && Kills[playerid]<= 5100)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 11 Levelis.");
	}
	else if(Kills[playerid]>5100 && Kills[playerid]<= 7650)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 12 Levelis.");
	}
	else if(Kills[playerid]>7650 && Kills[playerid]<= 11475)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 13 Levelis.");
	}
	else if(Kills[playerid]>11475 && Kills[playerid]<= 17500)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 14 Levelis.");
	}
	else if(Kills[playerid]>17500 && Kills[playerid]<= 26250)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 15 Levelis.");
	}
	else if(Kills[playerid]>26250 && Kills[playerid]<= 39375)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 16 Levelis.");
	}
	else if(Kills[playerid]>39375 && Kills[playerid]<= 60000)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 17 Levelis.");
	}
	else if(Kills[playerid]>60000 && Kills[playerid]<= 100000)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 18 Levelis.");
	}
	else if(Kills[playerid]> 100000)
	{
	SendClientMessage(playerid,COLOR_WHITE,"[FunZoneLT]>> 19 Levelis.");
	}
	return 1;
}
stock GetPlayerKills(playerid)
{
	return Kills[playerid];
}
stock GetPlayerDeaths(playerid)
{
	return Deaths[playerid];
}
public OnPlayerUpdate(playerid)
{
	new str[256];
	format(str,sizeof(str),"~r~Nuzudymai: ~w~%d ~g~Mirtys: ~w~%d",Kills[playerid],Deaths[playerid]);
	TextDrawSetString(Text:Stats[playerid],str);
	if(Kills[playerid]<10)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 1 Levelis");
	}
	else if(Kills[playerid]>10 && Kills[playerid]<=75)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 2 Levelis");
	}
	else if(Kills[playerid]>75 && Kills[playerid]<=150)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 3 Levelis");
	}
	else if(Kills[playerid]>150 && Kills[playerid]<=300)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 4 Levelis");
	}
	else if(Kills[playerid]>300 && Kills[playerid]<=450)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 5 Levelis");
	}
	else if(Kills[playerid]>450 && Kills[playerid]<= 675)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 6 Levelis");
	}
	else if(Kills[playerid]>675 && Kills[playerid]<= 1000)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 7 Levelis");
	}
	else if(Kills[playerid]>1000 && Kills[playerid]<= 1500)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 8 Levelis");
	}
	else if(Kills[playerid]>1500 && Kills[playerid]<= 2250)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 9 Levelis");
	}
	else if(Kills[playerid]>2250 && Kills[playerid]<= 3375)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 10 Levelis");
	}
	else if(Kills[playerid]>3375 && Kills[playerid]<= 5100)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 11 Levelis");
	}
	else if(Kills[playerid]>5100 && Kills[playerid]<= 7650)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 12 Levelis");
	}
	else if(Kills[playerid]>7650 && Kills[playerid]<= 11475)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 13 Levelis");                                                                                                                                                                 /*Scripted By Sufyan*/
	}
	else if(Kills[playerid]>11475 && Kills[playerid]<= 17500)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 14 Levelis");
	}
	else if(Kills[playerid]>17500 && Kills[playerid]<= 26250)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~LYGIS:~w~ 15 Levelis");
	}
	else if(Kills[playerid]>26250 && Kills[playerid]<= 39375)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 16 Levelis");
	}
	else if(Kills[playerid]>39375 && Kills[playerid]<= 60000)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 17 Levelis");
	}
	else if(Kills[playerid]>60000 && Kills[playerid]<= 100000)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 18 Levelis");
	}
	else if(Kills[playerid]> 100000)
	{
	TextDrawSetString(Text:R_1[playerid],"~r~Lygis:~w~ 19 Levelis");
	}
	return 1;
}
Reply
#2

Try to make a check if killerid isn't equal to invalid player id:

pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    if ( killerid != INVALID_PLAYER_ID )
    {
        Kills[ killerid ] ++;
    }
    Deaths[ playerid ] ++;
    return true;
}
Reply
#3

Not works
Reply
#4

Someone, look who is here.
Reply
#5

Help me!
Reply
#6

Me do not show in textdraw that you killed a player, or die. Anyone can help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)