#include <a_samp>
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new rank[ MAX_PLAYERS ];
public OnFilterScriptInit()
{
Textdraw0 = TextDrawCreate(414.000000, 404.000000, "Score:~r~");
TextDrawBackgroundColor(Textdraw0, 16711935);
TextDrawFont(Textdraw0, 2);
TextDrawLetterSize(Textdraw0, 0.529999, 2.599999);
TextDrawColor(Textdraw0, 65535);
TextDrawSetOutline(Textdraw0, 1);
TextDrawSetProportional(Textdraw0, 1);
Textdraw2 = TextDrawCreate(414.000000, 384.000000, "Rank:~r~");
TextDrawBackgroundColor(Textdraw2, 16711935);
TextDrawFont(Textdraw2, 2);
TextDrawLetterSize(Textdraw2, 0.570000, 2.700000);
TextDrawColor(Textdraw2, 65535);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
return 1;
}
public OnPlayerSpawn( playerid )
{
TextDrawShowForPlayer( playerid, Textdraw0 );
TextDrawShowForPlayer( playerid, Textdraw1 );
TextDrawShowForPlayer( playerid, Textdraw2 );
return 1;
}
public OnPlayerUpdate( playerid )
{
new string[ 128 ];
new score;
score = GetPlayerScore(playerid);
format( string, sizeof string, "Score:~r~ %d", score );
TextDrawSetString(Textdraw0, string);
if(GetPlayerScore(playerid) >= 1000) rank[ playerid ] = (500, 100, "General");
else if(GetPlayerScore(playerid) >= 700) rank[ playerid ] = (500, 100, "Captain");
else if(GetPlayerScore(playerid) >= 500) rank[ playerid ] = (500, 100, "Lieutenant");
else if(GetPlayerScore(playerid) >= 200) rank[ playerid ] = (500, 100, "Sergeant");
else if(GetPlayerScore(playerid) >= 100) rank[ playerid ] = (500, 100, "Corporal");
else if(GetPlayerScore(playerid) >= 50) rank[ playerid ] = (500, 100, "Privat First Class");
else if(GetPlayerScore(playerid) >= 0) rank[ playerid ] = (500, 100, "Privat");
format( string, sizeof string, "Rank:~r~ %d", rank[ playerid ] );
TextDrawSetString( Textdraw2, string );
return 1;
}
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(44) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(45) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(46) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(47) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(48) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(49) : error 006: must be assigned to an array
C:\Users\Admin\Desktop\COD9 - Battlefield\filterscripts\ranking.pwn(50) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
7 Errors.
new Text:Textdraw0[MAX_PLAYERS];
//Probably OnPlayerConnect for you
Textdraw0[playerid] = TextDrawCreate(414.000000, 404.000000, "Score:~r~");
TextDrawBackgroundColor(Textdraw0[playerid], 16711935);
TextDrawFont(Textdraw0[playerid], 2);
TextDrawLetterSize(Textdraw0[playerid], 0.529999, 2.599999);
TextDrawColor(Textdraw0[playerid], 65535);
TextDrawSetOutline(Textdraw0[playerid], 1);
TextDrawSetProportional(Textdraw0[playerid], 1);
Well before someone helps you with those errors..
I gotta tell you that how your setting up your textdraws will not work for all the players as it will be showing someone else's score each time it updates..you need to learn how to create Textdraws for individual players Heres a small example: pawn Код:
|
Well before someone helps you with those errors..
I gotta tell you that how your setting up your textdraws will not work for all the players as it will be showing someone else's score each time it updates..you need to learn how to create Textdraws for individual players Heres a small example: pawn Код:
|
#include <a_samp>
new Text:_score[MAX_PLAYERS];
new Text:_rank[MAX_PLAYERS];
new rank[MAX_PLAYERS][20];
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
_score[playerid] = TextDrawCreate(414.000000, 404.000000, "Score:~r~");
TextDrawBackgroundColor(_score[playerid], 16711935);
TextDrawFont(_score[playerid], 2);
TextDrawLetterSize(_score[playerid], 0.529999, 2.599999);
TextDrawColor(_score[playerid], 65535);
TextDrawSetOutline(_score[playerid], 1);
TextDrawSetProportional(_score[playerid], 1);
_rank[playerid] = TextDrawCreate(414.000000, 384.000000, "Rank:~r~");
TextDrawBackgroundColor(_rank[playerid], 16711935);
TextDrawFont(_rank[playerid], 2);
TextDrawLetterSize(_rank[playerid], 0.570000, 2.700000);
TextDrawColor(_rank[playerid], 65535);
TextDrawSetOutline(_rank[playerid], 1);
TextDrawSetProportional(_rank[playerid], 1);
}
public OnPlayerDisconnect(playerid)
{
TextDrawHideForPlayer(playerid, _score[playerid]);
TextDrawHideForPlayer(playerid, _rank[playerid]);
TextDrawDestroy(_score[playerid]);
TextDrawDestroy(_rank[playerid]);
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer( playerid, _score[playerid]);
TextDrawShowForPlayer( playerid, _rank[playerid]);
return 1;
}
public OnPlayerUpdate(playerid)
{
new string[128];
new score = GetPlayerScore(playerid);
format(string, sizeof(string), "Score:~r~ %d", score);
TextDrawSetString(_score[playerid], string);
if(GetPlayerScore(playerid) >= 1000) rank[playerid] = (500, 100, "General");
else if(GetPlayerScore(playerid) >= 700) rank[playerid] = (500, 100, "Captain");
else if(GetPlayerScore(playerid) >= 500) rank[playerid] = (500, 100, "Lieutenant");
else if(GetPlayerScore(playerid) >= 200) rank[playerid] = (500, 100, "Sergeant");
else if(GetPlayerScore(playerid) >= 100) rank[playerid] = (500, 100, "Corporal");
else if(GetPlayerScore(playerid) >= 50) rank[playerid] = (500, 100, "Private First Class");
else if(GetPlayerScore(playerid) >= 0) rank[playerid] = (500, 100, "Private");
format( string, sizeof string, "Rank:~r~ %d", rank[playerid]);
TextDrawSetString(_rank[playerid], string);
return 1;
}
You should only do that to textdraws that are unique to the player, textdraw0 will be the same for all players, no sense in creating it 500 times
|
Here ya go:
pawn Код:
(500, 100, " ") Not sure if you read it thoroughly but it is unique to the player and its not creating it 500 times as its actually being created when the player connects |