04.03.2017, 07:42
Hello guys, i have tried a lot of time to convert XP Stats from dialog to TextDraw and im getting fail always!
here is my code:
Here it is the problem, when i gave myself xp those xp which it got given it's now showing in the textdraw!
Note:Textdraw3 -> just a simple textdraw, Textdraw4 -> is the XP Textdraw.
Any help are welcome
here is my code:
PHP код:
new Text:Textdraw3;
new Text:Textdraw4[MAX_PLAYERS];
enum pInfo
{
pXP
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnGameModeInit()
{
Textdraw3 = TextDrawCreate(522.000000, 382.000000, "Experience:");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 0.500000, 2.099999);
TextDrawColor(Textdraw3, -16776961);
TextDrawSetOutline(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
for(new i; i < MAX_PLAYERS; i ++)
{
Textdraw4[i] = TextDrawCreate(522.000000, 404.000000, "0/10000");
TextDrawBackgroundColor(Textdraw4[i], 255);
TextDrawFont(Textdraw4[i], 1);
TextDrawLetterSize(Textdraw4[i], 0.469999, 2.000000);
TextDrawColor(Textdraw4[i], -1);
TextDrawSetOutline(Textdraw4[i], 0);
TextDrawSetProportional(Textdraw4[i], 1);
TextDrawSetShadow(Textdraw4[i], 1);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw4[playerid]);
return 1;
}
CMD:givexp(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new
string[400],
pname[MAX_PLAYER_NAME],
tname[MAX_PLAYER_NAME],
targetid,
maxcookies;
if(sscanf(params, "ii", targetid, maxcookies))
{
return SendClientMessage(playerid, 0xF8F8F8FFF, "Syntax: {F00f00}/givexp [ID] [Amount]");
}
if((!IsPlayerConnected(targetid)) || (targetid == INVALID_PLAYER_ID)) return SendClientMessage(playerid, 0xFF0000, "ERROR: {FFFFFF}Player isn't Connected!");
if(maxcookies < 0 || maxcookies > 10000000) return SendClientMessage( playerid, 0xF8F8F8FFF, "ERROR: {FFFFFF}highest amount is 1000000.");
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(targetid, tname, sizeof(tname));
format(string, sizeof(string), "{99bec3}Administrator {FFD700}%s {99bec3}has {15ff00}gave {FFD700}%s {FFD700}%i {99bec3}XP!", pname, tname, maxcookies);
SendClientMessageToAll(0xF8F8F8FFF, string);
GameTextForPlayer(targetid,"~W~W~P~O~R~W! ~Y~N~G~I~R~C~P~E! ~Y~X~P~P ~R~:)",3000,3);
new INI:File = INI_Open(UserPath(targetid));
PlayerInfo[targetid][pXP] += maxcookies;
INI_WriteInt(File,"XP",maxcookies);
INI_Close(File);
}
else
SendClientMessage(playerid, 0xf8F8F8FFF,"ERROR: {FFFFFF}You aren't authorized to use this command.");
return 1;
}
Note:Textdraw3 -> just a simple textdraw, Textdraw4 -> is the XP Textdraw.
Any help are welcome