not work Text Draw!
#1

Help!!!





Code:

Код:
#include <a_samp>
new PlayerText:KillsLevel[MAX_PLAYERS];
public OnFilterScriptExit()
{
	for(new i = GetMaxPlayers() - 1; i != -1; i--)
	{
		if(!IsPlayerConnected(i)) continue;
		PlayerTextDrawDestroy(i, KillsLevel[i]);
	}
	return 1;
}
public OnPlayerConnect(playerid)
{
	KillsLevel[playerid] = CreatePlayerTextDraw(playerid, 499.0, 101.0, "Kills: 0/0\nLevel: 0");
	PlayerTextDrawFont(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawLetterSize(playerid, KillsLevel[playerid], 0.34, 1.5);
	PlayerTextDrawSetOutline(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawColor(playerid, KillsLevel[playerid], 0xFDE39DFF);
	PlayerTextDrawAlignment(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawShow(playerid, KillsLevel[playerid]);
	return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
	#pragma unused reason
	PlayerTextDrawDestroy(playerid, KillsLevel[playerid]);
	return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
	#pragma unused reason
    SetPlayerScore (killerid, GetPlayerScore (killerid) + 1);
    new kills = GetPlayerScore(killerid);
    if(kills % 50 == 0) SetPlayerScore(killerid,GetPlayerScore(playerid) + 1);
    new level = GetPlayerScore(playerid), string[32];
	format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
	PlayerTextDrawSetString(killerid, KillsLevel[killerid], string);
	return 1;
}
Reply
#2

new level = GetPlayerScore(playerid), string[32];

Should probably be, new level = GetPlayerScore(killerid), string[32];

You also have these lines mixed up a bit....

KillsLevel[playerid] = CreatePlayerTextDraw(playerid, 499.0, 101.0, "Kills: 0/0\nLevel: 0")

format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);

You want.... format(string, sizeof(string), "Kills: %d/%d\nLevel: %d", kills, level * 50, level);
Reply
#3

not work
Reply
#4

Well it will only update when you kill a player not when you connect in that case you need...


Код:
public OnPlayerConnect(playerid)
{
	KillsLevel[playerid] = CreatePlayerTextDraw(playerid, 499.0, 101.0, "Kills: 0/0\nLevel: 0");
	PlayerTextDrawFont(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawLetterSize(playerid, KillsLevel[playerid], 0.34, 1.5);
	PlayerTextDrawSetOutline(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawColor(playerid, KillsLevel[playerid], 0xFDE39DFF);
	PlayerTextDrawAlignment(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawShow(playerid, KillsLevel[playerid]);
        UpdateKillsLevel(playerid);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    #pragma unused reason
    SetPlayerScore (killerid, GetPlayerScore (killerid) + 1);
    UpdateKillsLevel(killerid);
    return 1;
}

UpdateKillsLevel(playerid)
{
    new kills = GetPlayerScore(playerid);
    if(kills % 50 == 0) SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
    new level = GetPlayerScore(playerid), string[32];
    format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
    PlayerTextDrawSetString(playerid, KillsLevel[playerid], string);
}
Reply
#5

omg

Код:
(758) : error 017: undefined symbol "killerid"
(759) : error 017: undefined symbol "killerid"
(762) : error 017: undefined symbol "killerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
UpdateKillsLevel(playerid)
{
    new kills = GetPlayerScore(killerid);   // <<<<<
    if(kills % 50 == 0) SetPlayerScore(killerid,GetPlayerScore(playerid) + 1); // <<<<<<
    new level = GetPlayerScore(playerid), string[32];
    format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
    PlayerTextDrawSetString(killerid, KillsLevel[killerid], string); // <<<<<<<
}
Reply
#6

Код:
UpdateKillsLevel(playerid)
{
    new kills = GetPlayerScore(playerid);   // <<<<<
    if(kills % 50 == 0) SetPlayerScore(playerid,GetPlayerScore(playerid) + 1); // <<<<<<
    new level = GetPlayerScore(playerid), string[32];
    format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
    PlayerTextDrawSetString(playerid, KillsLevel[playerid], string); // <<<<<<<
}
No Eror




Code:

Код:
new PlayerText:KillsLevel[MAX_PLAYERS];

public OnGameModeExit()
{
	for(new i = GetMaxPlayers() - 1; i != -1; i--)
	{
		if(!IsPlayerConnected(i)) continue;
		PlayerTextDrawDestroy(i, KillsLevel[i]);
	}
	return 1;
}

public OnPlayerConnect(playerid)
{
	KillsLevel[playerid] = CreatePlayerTextDraw(playerid, 499.0, 101.0, "Kills: 0/0\nLevel: 0");
	PlayerTextDrawFont(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawLetterSize(playerid, KillsLevel[playerid], 0.34, 1.5);
	PlayerTextDrawSetOutline(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawColor(playerid, KillsLevel[playerid], 0xFDE39DFF);
	PlayerTextDrawAlignment(playerid, KillsLevel[playerid], 1);
	PlayerTextDrawShow(playerid, KillsLevel[playerid]);
    UpdateKillsLevel(playerid);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	#pragma unused reason
	PlayerTextDrawDestroy(playerid, KillsLevel[playerid]);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	#pragma unused reason
    SetPlayerScore (killerid, GetPlayerScore (killerid) + 1);
    UpdateKillsLevel(playerid);
	return 1;
}

UpdateKillsLevel(playerid)
{
    new kills = GetPlayerScore(playerid);   // <<<<<
    if(kills % 50 == 0) SetPlayerScore(playerid,GetPlayerScore(playerid) + 1); // <<<<<<
    new level = GetPlayerScore(playerid), string[32];
    format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
    PlayerTextDrawSetString(playerid, KillsLevel[playerid], string); // <<<<<<<
}
Reply
#7

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    #pragma unused reason
    SetPlayerScore (killerid, GetPlayerScore (killerid) + 1);
    UpdateKillsLevel(killerid);
    return 1;
}

UpdateKillsLevel(playerid)
{
    new kills = GetPlayerScore(playerid);
    if(kills % 50 == 0) SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
    new level = GetPlayerScore(playerid), string[32];
    format(string, sizeof(string), "Level: %d\nKills: %d/%d", level, kills, level * 50);
    PlayerTextDrawSetString(playerid, KillsLevel[playerid], string);
    PlayerTextDrawShow( playerid , KillsLevel[playerid] );
}
remember to update it is necessary to kill someone..!
Reply
#8




Level 54
Kills 54/2700
Reply
#9

want that say the TextDraw ?
Reply
#10

Quote:
Originally Posted by cesar_******
Посмотреть сообщение
want that say the TextDraw ?
on the screen LEVEL = KILLS
but should be
1 level = 50 kills
2 level = 100 kills

p.s Sorry for bad English
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)