Need to show kills
#1

thanks to these guys for fix.
Reply
#2

pawn Код:
public OnGameModeInit()
{
SetTimer("MapKill1", 1000, 1);
SetTimer("MapKill2", 1000, 1);
return 1;
}

forward MapKill1();
public MapKill1()
{
TextDrawHideForAll(Textdraw12);
new string[16];
format(string, sizeof string, "%d", MapKillsSoldiers);
TextDrawSetString(Textdraw12, string);
TextDrawShowForAll(Textdraw12);
return 1;
}

forward MapKill2();
public MapKill2()
{
TextDrawHideForAll(Textdraw13);
new string[16];
format(string, sizeof string, "%d", MapKillsTerrorists);
TextDrawSetString(Textdraw13, string);
TextDrawShowForAll(Textdraw13);
return 1;
}
Reply
#3

Should work.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[20];
    if(pInfo[killerid][Team] == 1)
    {
        MapKillsSoldiers++;
        format(string, sizeof (string), "%i", MapKillsSoldiers);
        TextDrawSetString(Textdraw12, string); // Change "Textdraw12" to your MapKillsSoldiers textdraw ID.
    }
    if(pInfo[killerid][Team] == 2)
    {
        MapKillsTerrorists++;
        format(string, sizeof (string), "%i", MapKillsTerrorists);
        TextDrawSetString(Textdraw13, string); // Change "Textdraw13" to your MapKillsTerrorists textdraw ID.
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by jidavid
Посмотреть сообщение
pawn Код:
public OnGameModeInit()
{
SetTimer("MapKill1", 1000, 1);
SetTimer("MapKill2", 1000, 1);
return 1;
}

forward MapKill1();
public MapKill1()
{
TextDrawHideForAll(Textdraw12);
new string[16];
format(string, sizeof string, "%d", MapKillsSoldiers);
TextDrawSetString(Textdraw12, string);
TextDrawShowForAll(Textdraw12);
return 1;
}

forward MapKill2();
public MapKill2()
{
TextDrawHideForAll(Textdraw13);
new string[16];
format(string, sizeof string, "%d", MapKillsTerrorists);
TextDrawSetString(Textdraw13, string);
TextDrawShowForAll(Textdraw13);
return 1;
}
Awesome mate, Repped++

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Should work.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[20];
    if(pInfo[killerid][Team] == 1)
    {
        MapKillsSoldiers++;
        format(string, sizeof (string), "%i", MapKillsSoldiers);
        TextDrawSetString(Textdraw12, string); // Change "Textdraw12" to your MapKillsSoldiers textdraw ID.
    }
    if(pInfo[killerid][Team] == 2)
    {
        MapKillsTerrorists++;
        format(string, sizeof (string), "%i", MapKillsTerrorists);
        TextDrawSetString(Textdraw13, string); // Change "Textdraw13" to your MapKillsTerrorists textdraw ID.
    }
    return 1;
}
Didn't tested but thank you very much.
Repped+
Reply
#5

You should check if 'killerid' is not INVALID_PLAYER_ID, otherwise your server will crash...
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == INVALID_PLAYER_ID) return 1;
    new string[12];
    if(pInfo[killerid][Team] == 1)
    {
        MapKillsSoldiers++;
        format(string, sizeof (string), "%i", MapKillsSoldiers);
        TextDrawSetString(Textdraw12, string); // Change "Textdraw12" to your MapKillsSoldiers textdraw ID.
    }
    if(pInfo[killerid][Team] == 2)
    {
        MapKillsTerrorists++;
        format(string, sizeof (string), "%i", MapKillsTerrorists);
        TextDrawSetString(Textdraw13, string); // Change "Textdraw13" to your MapKillsTerrorists textdraw ID.
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)