Hey,
wenn ich und Fabi.StaR auf meinen DM-Server joinen,
werden bei ihm die Stats angezeigt und bei mir nicht.
Bei mir steht immer nur "Stats" aber die Box und so
weiter nicht.. Die Stats sind als Textdraw angezeigt.
Hier ist mal mein Code.
Ich hoffe mir kann einer helfen.
Definitionen:
new Text:StatGeld[MP];
new Text:StatKills[MP];
new Text:StatTode[MP];
new Text:StatName[MP];
new Text:StatStats[MP];
new Text:StatKD[MP];
new Text:StatScore[MP];
new Text:StatKills[MP];
new Text:StatTode[MP];
new Text:StatName[MP];
new Text:StatStats[MP];
new Text:StatKD[MP];
new Text:StatScore[MP];
Erstellung der Textdraws:
for(new i=0; i<MAX_PLAYERS; i++)
{
StatGeld[i] = TextDrawCreate(506.000000, 180.000000, "");
TextDrawBackgroundColor(StatGeld[i], 255);
TextDrawFont(StatGeld[i], 2);
TextDrawLetterSize(StatGeld[i], 0.270000, 1.000000);
TextDrawColor(StatGeld[i], -10066177);
TextDrawSetOutline(StatGeld[i], 0);
TextDrawSetProportional(StatGeld[i], 1);
TextDrawSetShadow(StatGeld[i], 1);
TextDrawUseBox(StatGeld[i], 1);
TextDrawBoxColor(StatGeld[i], 255);
TextDrawTextSize(StatGeld[i], 607.000000, 0.000000);
StatKills[i] = TextDrawCreate(506.000000, 190.000000, "");
TextDrawBackgroundColor(StatKills[i], 255);
TextDrawFont(StatKills[i], 2);
TextDrawLetterSize(StatKills[i], 0.260000, 1.000000);
TextDrawColor(StatKills[i], -10066177);
TextDrawSetOutline(StatKills[i], 0);
TextDrawSetProportional(StatKills[i], 1);
TextDrawSetShadow(StatKills[i], 1);
TextDrawUseBox(StatKills[i], 1);
TextDrawBoxColor(StatKills[i], 255);
TextDrawTextSize(StatKills[i], 607.000000, 0.000000);
{
StatGeld[i] = TextDrawCreate(506.000000, 180.000000, "");
TextDrawBackgroundColor(StatGeld[i], 255);
TextDrawFont(StatGeld[i], 2);
TextDrawLetterSize(StatGeld[i], 0.270000, 1.000000);
TextDrawColor(StatGeld[i], -10066177);
TextDrawSetOutline(StatGeld[i], 0);
TextDrawSetProportional(StatGeld[i], 1);
TextDrawSetShadow(StatGeld[i], 1);
TextDrawUseBox(StatGeld[i], 1);
TextDrawBoxColor(StatGeld[i], 255);
TextDrawTextSize(StatGeld[i], 607.000000, 0.000000);
StatKills[i] = TextDrawCreate(506.000000, 190.000000, "");
TextDrawBackgroundColor(StatKills[i], 255);
TextDrawFont(StatKills[i], 2);
TextDrawLetterSize(StatKills[i], 0.260000, 1.000000);
TextDrawColor(StatKills[i], -10066177);
TextDrawSetOutline(StatKills[i], 0);
TextDrawSetProportional(StatKills[i], 1);
TextDrawSetShadow(StatKills[i], 1);
TextDrawUseBox(StatKills[i], 1);
TextDrawBoxColor(StatKills[i], 255);
TextDrawTextSize(StatKills[i], 607.000000, 0.000000);
StatTode[i] = TextDrawCreate(506.000000, 200.000000, "");
TextDrawBackgroundColor(StatTode[i], 255);
TextDrawFont(StatTode[i], 2);
TextDrawLetterSize(StatTode[i], 0.270000, 1.000000);
TextDrawColor(StatTode[i], -10066177);
TextDrawSetOutline(StatTode[i], 0);
TextDrawSetProportional(StatTode[i], 1);
TextDrawSetShadow(StatTode[i], 1);
TextDrawUseBox(StatTode[i], 1);
TextDrawBoxColor(StatTode[i], 255);
TextDrawTextSize(StatTode[i], 607.000000, 0.000000);
StatName[i] = TextDrawCreate(508.000000, 168.000000, "");
TextDrawBackgroundColor(StatName[i], 255);
TextDrawFont(StatName[i], 2);
TextDrawLetterSize(StatName[i], 0.200000, 1.000000);
TextDrawColor(StatName[i], -993737473);
TextDrawSetOutline(StatName[i], 0);
TextDrawSetProportional(StatName[i], 1);
TextDrawSetShadow(StatName[i], 1);
StatStats[i] = TextDrawCreate(502.000000, 158.000000, "[ ] Stats");
TextDrawBackgroundColor(StatStats[i], 255);
TextDrawFont(StatStats[i], 0);
TextDrawLetterSize(StatStats[i], 0.500000, 1.000000);
TextDrawColor(StatStats[i], -1);
TextDrawSetOutline(StatStats[i], 0);
TextDrawSetProportional(StatStats[i], 1);
TextDrawSetShadow(StatStats[i], 1);
StatKD[i] = TextDrawCreate(530.000000, 222.000000, "");
TextDrawBackgroundColor(StatKD[i], 255);
TextDrawFont(StatKD[i], 2);
TextDrawLetterSize(StatKD[i], 0.160000, 0.799999);
TextDrawColor(StatKD[i], -993737473);
TextDrawSetOutline(StatKD[i], 0);
TextDrawSetProportional(StatKD[i], 1);
TextDrawSetShadow(StatKD[i], 1);
StatScore[i] = TextDrawCreate(506.000000, 210.000000, "");
TextDrawBackgroundColor(StatScore[i], 255);
TextDrawFont(StatScore[i], 2);
TextDrawLetterSize(StatScore[i], 0.230000, 1.100000);
TextDrawColor(StatScore[i], -10066177);
TextDrawSetOutline(StatScore[i], 0);
TextDrawSetProportional(StatScore[i], 1);
TextDrawSetShadow(StatScore[i], 1);
TextDrawUseBox(StatScore[i], 1);
TextDrawBoxColor(StatScore[i], 255);
TextDrawTextSize(StatScore[i], 607.000000, 0.000000);
}
TextDrawBackgroundColor(StatTode[i], 255);
TextDrawFont(StatTode[i], 2);
TextDrawLetterSize(StatTode[i], 0.270000, 1.000000);
TextDrawColor(StatTode[i], -10066177);
TextDrawSetOutline(StatTode[i], 0);
TextDrawSetProportional(StatTode[i], 1);
TextDrawSetShadow(StatTode[i], 1);
TextDrawUseBox(StatTode[i], 1);
TextDrawBoxColor(StatTode[i], 255);
TextDrawTextSize(StatTode[i], 607.000000, 0.000000);
StatName[i] = TextDrawCreate(508.000000, 168.000000, "");
TextDrawBackgroundColor(StatName[i], 255);
TextDrawFont(StatName[i], 2);
TextDrawLetterSize(StatName[i], 0.200000, 1.000000);
TextDrawColor(StatName[i], -993737473);
TextDrawSetOutline(StatName[i], 0);
TextDrawSetProportional(StatName[i], 1);
TextDrawSetShadow(StatName[i], 1);
StatStats[i] = TextDrawCreate(502.000000, 158.000000, "[ ] Stats");
TextDrawBackgroundColor(StatStats[i], 255);
TextDrawFont(StatStats[i], 0);
TextDrawLetterSize(StatStats[i], 0.500000, 1.000000);
TextDrawColor(StatStats[i], -1);
TextDrawSetOutline(StatStats[i], 0);
TextDrawSetProportional(StatStats[i], 1);
TextDrawSetShadow(StatStats[i], 1);
StatKD[i] = TextDrawCreate(530.000000, 222.000000, "");
TextDrawBackgroundColor(StatKD[i], 255);
TextDrawFont(StatKD[i], 2);
TextDrawLetterSize(StatKD[i], 0.160000, 0.799999);
TextDrawColor(StatKD[i], -993737473);
TextDrawSetOutline(StatKD[i], 0);
TextDrawSetProportional(StatKD[i], 1);
TextDrawSetShadow(StatKD[i], 1);
StatScore[i] = TextDrawCreate(506.000000, 210.000000, "");
TextDrawBackgroundColor(StatScore[i], 255);
TextDrawFont(StatScore[i], 2);
TextDrawLetterSize(StatScore[i], 0.230000, 1.100000);
TextDrawColor(StatScore[i], -10066177);
TextDrawSetOutline(StatScore[i], 0);
TextDrawSetProportional(StatScore[i], 1);
TextDrawSetShadow(StatScore[i], 1);
TextDrawUseBox(StatScore[i], 1);
TextDrawBoxColor(StatScore[i], 255);
TextDrawTextSize(StatScore[i], 607.000000, 0.000000);
}
Anzeige der Textdraws per Befehl:
ocmd:stats(playerid,params[])
{
if(Statistik[playerid] == false)
{
TextDrawShowForPlayer(playerid, StatStats[playerid]);
TextDrawShowForPlayer(playerid, StatName[playerid]);
TextDrawShowForPlayer(playerid, StatGeld[playerid]);
TextDrawShowForPlayer(playerid, StatKills[playerid]);
TextDrawShowForPlayer(playerid, StatTode[playerid]);
TextDrawShowForPlayer(playerid, StatKD[playerid]);
TextDrawShowForPlayer(playerid, StatScore[playerid]);
Statistik[playerid] = true;
return 1;
}
if(Statistik[playerid] == true)
{
TextDrawHideForPlayer(playerid, StatStats[playerid]);
TextDrawHideForPlayer(playerid, StatName[playerid]);
TextDrawHideForPlayer(playerid, StatGeld[playerid]);
TextDrawHideForPlayer(playerid, StatKills[playerid]);
TextDrawHideForPlayer(playerid, StatTode[playerid]);
TextDrawHideForPlayer(playerid, StatKD[playerid]);
TextDrawHideForPlayer(playerid, StatScore[playerid]);
return 1;
}
return 1;
}
{
if(Statistik[playerid] == false)
{
TextDrawShowForPlayer(playerid, StatStats[playerid]);
TextDrawShowForPlayer(playerid, StatName[playerid]);
TextDrawShowForPlayer(playerid, StatGeld[playerid]);
TextDrawShowForPlayer(playerid, StatKills[playerid]);
TextDrawShowForPlayer(playerid, StatTode[playerid]);
TextDrawShowForPlayer(playerid, StatKD[playerid]);
TextDrawShowForPlayer(playerid, StatScore[playerid]);
Statistik[playerid] = true;
return 1;
}
if(Statistik[playerid] == true)
{
TextDrawHideForPlayer(playerid, StatStats[playerid]);
TextDrawHideForPlayer(playerid, StatName[playerid]);
TextDrawHideForPlayer(playerid, StatGeld[playerid]);
TextDrawHideForPlayer(playerid, StatKills[playerid]);
TextDrawHideForPlayer(playerid, StatTode[playerid]);
TextDrawHideForPlayer(playerid, StatKD[playerid]);
TextDrawHideForPlayer(playerid, StatScore[playerid]);
return 1;
}
return 1;
}
Aktualisierung der Textdraws per Sekundentimer:
public UpdateStats()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Statistik[i] == true)
{
//NAME
new name[MAX_PLAYER_NAME], namestr[64];
GetPlayerName(i,name,sizeof(name));
format(namestr,sizeof(namestr),"Name: %s",name);
TextDrawSetString(StatName[i],namestr);
//GELD
new money, moneystr[64];
money = GetPlayerMoney(i);
format(moneystr,sizeof(moneystr),"Geld: %i",money);
TextDrawSetString(StatGeld[i],moneystr);
//KILLS
new kills, killstr[64];
kills = PlayerInfo[i][pKills];
format(killstr,sizeof(killstr),"Kills: %i",kills);
TextDrawSetString(StatKills[i],killstr);
//DEATHS
new tode, todstr[64];
tode = PlayerInfo[i][pDeaths];
format(todstr,sizeof(todstr),"Tode: %i",tode);
TextDrawSetString(StatTode[i],todstr);
//SCORE
new pscore, scorestr[64];
pscore = GetPlayerScore(i);
format(scorestr,sizeof(scorestr),"Score: %i",pscore);
TextDrawSetString(StatScore[i],scorestr);
//K/D
new kdstr[128];
new Float:kd = floatdiv(kills,tode);
format(kdstr,sizeof(kdstr),"K/D-Rate: %.2f",kd);
TextDrawSetString(StatKD[i],kdstr);
//ANZEIGEN LASSEN
TextDrawShowForPlayer(i, StatStats[i]);
TextDrawShowForPlayer(i, StatName[i]);
TextDrawShowForPlayer(i, StatGeld[i]);
TextDrawShowForPlayer(i, StatKills[i]);
TextDrawShowForPlayer(i, StatTode[i]);
TextDrawShowForPlayer(i, StatKD[i]);
TextDrawShowForPlayer(i, StatScore[i]);
return 1;
}
else return 1;
}
return 1;
}
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Statistik[i] == true)
{
//NAME
new name[MAX_PLAYER_NAME], namestr[64];
GetPlayerName(i,name,sizeof(name));
format(namestr,sizeof(namestr),"Name: %s",name);
TextDrawSetString(StatName[i],namestr);
//GELD
new money, moneystr[64];
money = GetPlayerMoney(i);
format(moneystr,sizeof(moneystr),"Geld: %i",money);
TextDrawSetString(StatGeld[i],moneystr);
//KILLS
new kills, killstr[64];
kills = PlayerInfo[i][pKills];
format(killstr,sizeof(killstr),"Kills: %i",kills);
TextDrawSetString(StatKills[i],killstr);
//DEATHS
new tode, todstr[64];
tode = PlayerInfo[i][pDeaths];
format(todstr,sizeof(todstr),"Tode: %i",tode);
TextDrawSetString(StatTode[i],todstr);
//SCORE
new pscore, scorestr[64];
pscore = GetPlayerScore(i);
format(scorestr,sizeof(scorestr),"Score: %i",pscore);
TextDrawSetString(StatScore[i],scorestr);
//K/D
new kdstr[128];
new Float:kd = floatdiv(kills,tode);
format(kdstr,sizeof(kdstr),"K/D-Rate: %.2f",kd);
TextDrawSetString(StatKD[i],kdstr);
//ANZEIGEN LASSEN
TextDrawShowForPlayer(i, StatStats[i]);
TextDrawShowForPlayer(i, StatName[i]);
TextDrawShowForPlayer(i, StatGeld[i]);
TextDrawShowForPlayer(i, StatKills[i]);
TextDrawShowForPlayer(i, StatTode[i]);
TextDrawShowForPlayer(i, StatKD[i]);
TextDrawShowForPlayer(i, StatScore[i]);
return 1;
}
else return 1;
}
return 1;
}