18.05.2012, 08:54
I want that you can see your score in the textdraw, and it will update if you get a higher score.
public OnGameModeInit()
{
SetTimer("Update", 5000, true);
return 1;
}
forward Update();
public Update()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
TextDrawSetString(/*Your textdraw here*/, GetPlayerScore(i));
}
}
pawn Код:
|
C:\Users\Magdy\Desktop\Server 3.0e\filterscripts\d.pwn(286) : error 035: argument type mismatch (argument 2)
TextDrawSetString(Score, GetPlayerScore(i));
Код:
C:\Users\Magdy\Desktop\Server 3.0e\filterscripts\d.pwn(286) : error 035: argument type mismatch (argument 2) pawn Код:
|
TextDrawSetString(/*Your textdraw here*/, GetPlayerScore(i));
stock h_SetPlayerScore(playerid, score)
{
SetPlayerScore(playerid, score);
// Textdraw code here
new tdstring[24];
format(tdstring, sizeof(tdstring), "Score: ~Y~%i", score);
PlayerTextDrawSetString(playerid, TD_pScore[playerid], tdstring);
return 1;
}
#if defined _ALS_SetPlayerScore
#undef SetPlayerScore
#else
#define _ALS_SetPlayerScore
#endif
#define SetPlayerScore h_SetPlayerScore
Hook the function:
pawn Код:
You need to CREATE THE PLAYER-TEXTDRAW. https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw |
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xF30000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_LIGHTBLUE 0x00D0F6AA
#define COLOR_WHITE 0xF6F6F6AA
#define COLOR_PURPLE 0xA600F6AA
#define COLOR_TUT 0xF6C861AA
#define COLOR_ROYAL 0x00C1F6AA
#define COLOR_CWHITE 0xE0FFFFAA
#define PRIVATE 0
#define CORPORAL 1
#define SERGENTEANT 2
#define CAPTAIN 3
#define BRIGADIER 4
#define GENERAL 5
new Text:Private;
new Text:Corporal;
new Text:Sergenteant;
new Text:Captain;
new Text:Brigadier;
new Text:General;
new Text:Score;
new PlayerLogged[MAX_PLAYERS];
new Rank[MAX_PLAYERS];
stock h_SetPlayerScore(playerid, score)
{
SetPlayerScore(playerid, score);
Score = TextDrawCreate(496.000000, 128.000000, "Score: ");
TextDrawBackgroundColor(Score, 255);
TextDrawFont(Score, 1);
TextDrawLetterSize(Score, 0.440000, 1.500000);
TextDrawColor(Score, 16711935);
TextDrawSetOutline(Score, 1);
TextDrawSetProportional(Score, 1);
new tdstring[24];
format(tdstring, sizeof(tdstring), "Score: ~Y~%i", score);
PlayerTextDrawSetString(playerid, TD_pScore[playerid], tdstring);
return 1;
}
#if defined _ALS_SetPlayerScore
#undef SetPlayerScore
#else
#define _ALS_SetPlayerScore
#endif
#define SetPlayerScore h_SetPlayerScore