Posts: 153
Threads: 64
Joined: Nov 2013
I made a variable.
PHP код:
new kills[MAX_PLAYERS]
public OnPlayerDeath(playerid, killerid, reason)
{
kills[killerid]++;
return 1;
}
Here is the question, I made a textdraw and made it the kills itself
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
kills[killerid]++;
kills[playerid] = 0;
TextDrawSetString(Textdraw6, kills);
return 1;
}
When someone kills me or gets killed, It doesn't reset or change. What is the problem ?
Posts: 3,133
Threads: 71
Joined: Dec 2013
Reputation:
0
Is this supposed to be a server-wide textdraw, or a textdraw for one player?
Posts: 153
Threads: 64
Joined: Nov 2013
For the killerid and playerid, not server-wide
Posts: 400
Threads: 47
Joined: Aug 2013
Reputation:
0
you need to show the textdraw again after you edit the string
Posts: 153
Threads: 64
Joined: Nov 2013
i did, But it doesn't give numbers, It gives something weird like shapes. maybe because it's a string not integer ?
Posts: 153
Threads: 64
Joined: Nov 2013
I don't know, It just keeps giving strings not numbers.
Posts: 153
Threads: 64
Joined: Nov 2013
Quote:
Originally Posted by AiRaLoKa
first, you have to define it...
pawn Код:
new Text:Textdraw6[MAX_PLAYERS]; // So it will make it different for every player
then change evething
from
into
pawn Код:
Textdraw6[playerid] //except on the on player death
at the OnPlayerDeath
change
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { kills[killerid]++; kills[playerid] = 0; TextDrawSetString(Textdraw6, kills); return 1; }
into
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { new str[32]; kills[killerid]++; kills[playerid] = 0; format(str,sizeof(str,"%d",kills[killerid]);//to convert from integer into string TextDrawSetString(Textdraw6[killerid], str);//to set the killer's textdraw TextDrawShowForPlayer(killerid,Textdraw6[killerid]);//show the textdraw to killer
format(str,sizeof(str,"%d",kills[playerid]);//to convert from integer into string TextDrawSetString(Textdraw6[playerid], str);//to set the player's textdraw TextDrawShowForPlayer(playerid,Textdraw6[playerid]);//show the textdraw to player return 1; }
|
pawn Код:
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(853) : error 033: array must be indexed (variable "Textdraw6")
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(854) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(855) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(856) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(857) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(858) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(859) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(860) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(869) : error 035: argument type mismatch (argument 2)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(887) : error 035: argument type mismatch (argument 1)
C:\Users\zero\Downloads\EDM - Extreme Deathmatch Mania\gamemodes\Untitled.pwn(888) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
11 Errors.
The code
pawn Код:
Textdraw6 = TextDrawCreate(117.000000, 330.000000, "0");
TextDrawAlignment(Textdraw6, 2);
TextDrawBackgroundColor(Textdraw6, 255);
TextDrawFont(Textdraw6, 3);
TextDrawLetterSize(Textdraw6, 0.500000, 1.000000);
TextDrawColor(Textdraw6, -16776961);
TextDrawSetOutline(Textdraw6, 1);
TextDrawSetProportional(Textdraw6, 1);
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i, Textdraw5);
TextDrawShowForPlayer(i, Textdraw6);
}
}
TextDrawHideForAll(Textdraw6);
TextDrawDestroy(Textdraw6);