27.12.2016, 22:57
This Codes in my Gamemode
please help me what's Wrong i don't know why this have bugs and dos'nt work
PHP код:
new old_Exp[MAX_PLAYERS];
new new_Exp[MAX_PLAYERS];
public OnGameModeExit()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
TextDrawHideForAll(Rank[playerid]);
TextDrawDestroy(Rank[playerid]);
TextDrawHideForAll(Exp[playerid]);
TextDrawDestroy(Exp[playerid]);
}
return 1;
}
public OnPlayerConnect(playerid)
{
new_Exp[playerid] = 0;
old_Exp[playerid] = 120;
new temp_str[10];
strcat(new_string , "Exp:");
valstr(temp_str ,new_Exp[playerid]);
strcat(new_string ,temp_str[playerid]);
strcat(new_string , "/");
valstr(temp_str ,old_Exp[playerid]);
strcat(new_string ,temp_str[playerid]);
Exp[playerid] = TextDrawCreate(484.000000, 98.559997,new_string);
TextDrawLetterSize(Exp[playerid], 0.345998, 1.413333);
TextDrawAlignment(Exp[playerid], 1);
TextDrawColor(Exp[playerid], -2139094785);
TextDrawSetShadow(Exp[playerid], 0);
TextDrawSetOutline(Exp[playerid], 1);
TextDrawBackgroundColor(Exp[playerid], 51);
TextDrawFont(Exp[playerid], 1);
TextDrawSetProportional(Exp[playerid], 1);
Rank[playerid] = TextDrawCreate(483.999877, 113.493309, "Level: 0 Rank: Beginner");
TextDrawLetterSize(Rank[playerid], 0.353999, 1.450666);
TextDrawAlignment(Rank[playerid], 1);
TextDrawColor(Rank[playerid], -2139094785);
TextDrawSetShadow(Rank[playerid], 0);
TextDrawSetOutline(Rank[playerid], 1);
TextDrawBackgroundColor(Rank[playerid], 51);
TextDrawFont(Rank[playerid], 1);
TextDrawSetProportional(Rank[playerid], 1);
ExpFNL[playerid] = TextDrawCreate(472.000000, 126.186546, "Exp For Next Level: 120");
TextDrawLetterSize(ExpFNL[playerid], 0.373999, 1.383466);
TextDrawAlignment(ExpFNL[playerid], 1);
TextDrawColor(ExpFNL[playerid], -2139094785);
TextDrawSetShadow(ExpFNL[playerid], 0);
TextDrawSetOutline(ExpFNL[playerid], 1);
TextDrawBackgroundColor(ExpFNL[playerid], 51);
TextDrawFont(ExpFNL[playerid], 1);
TextDrawSetProportional(ExpFNL[playerid], 1);
TextDrawShowForPlayer(playerid, Exp[playerid]);
TextDrawShowForPlayer(playerid, Rank[playerid]);
TextDrawShowForPlayer(playerid, ExpFNL[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
SendDeathMessage(killerid, playerid, reason);
GivePlayerMoney(playerid,-GetPlayerMoney(playerid)/2);
PlayerInfo[killerid][pKills] += 1;
PlayerInfo[killerid][pScore] += 1;
SetPlayerScore(killerid, PlayerInfo[killerid][pScore]);
new temp_str[10];
new_Exp[killerid] = new_Exp[killerid] + 90;
new_Exp[playerid] = new_Exp[playerid] - 90;
if(new_Exp[playerid] < 0)
{
new_Exp[playerid] = 0;
}
if(new_Exp[killerid] >= 120)
{
old_Exp[killerid] = 380;
SendClientMessage(killerid,COLOR_YELLOW,"New Level");
}
new_string = "";
strcat(new_string , "Exp:");
valstr(temp_str ,new_Exp[killerid]);
strcat(new_string ,temp_str);
strcat(new_string , "/");
valstr(temp_str ,old_Exp[playerid]);
strcat(new_string ,temp_str);
TextDrawSetString(Exp[killerid], new_string);
TextDrawShowForPlayer(killerid, Exp[killerid]);
new_string = "";
strcat(new_string , "Exp:");
valstr(temp_str ,new_Exp[playerid]);
strcat(new_string ,temp_str);
strcat(new_string , "/");
valstr(temp_str ,old_Exp[playerid]);
strcat(new_string ,temp_str);
TextDrawSetString(Exp[playerid], new_string);
TextDrawShowForPlayer(playerid, Exp[playerid]);
}
return 1;
}