public OnPlayerConnect(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i)&& playerid != i)
{
new name[MAX_PLAYER_NAME], country[MAX_COUNTRY_NAME], gmt;
new str2[256];
GetPlayerName(playerid, name, sizeof(name));
country = GetPlayerCountryName(playerid);
gmt = GetPlayerGMT(playerid);
format(str2, sizeof(str2), "* %s %s(%d) has connected to the server from %s (GMT %d:00)",rankings,name,playerid, country, gmt);//Focus on the rankings only
SendClientMessageToAll(concolor,str2);
return 1;
}
if(GetPlayerScore(playerid) > 0 && GetPlayerScore(playerid) < 10))
{
SCM(playerid, concolor, "Newbie");
}
else if(GetPlayerScore(playerid) > 10 && GetPlayerScore(playerid) < 50)
{
SCM(playerid, concolor, "Trucker");
}
else if(GetPlayerScore(playerid) > 50 && GetPlayerScore(playerid) < 100)
{
SCM(playerid, concolor, "Experienced Trucker");
}
else if(GetPlayerScore(playerid) > 100 && GetPlayerScore(playerid) < 300)
{
SCM(playerid, concolor, "Elite");
}
else if(GetPlayerScore(playerid) >= 300)
{
SCM(playerid, concolor, "Captain");
}
* Newbie John(0) has connected to the server from ----- (GMT --:--)
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], country[MAX_COUNTRY_NAME], gmt, str2[256], pScore, rankings[20];
GetPlayerName(playerid, name, sizeof(name));
country = GetPlayerCountryName(playerid);
pScore = GetPlayerScore(playerid);
gmt = GetPlayerGMT(playerid);
if(pScore < 10)
{
rankings = "Newbie";
}
else if(pScore >= 10 && pScore < 50)
{
rankings = "Trucker";
}
else if(pScore >= 50 && pScore < 100)
{
rankings = "Experienced Trucker";
}
else if(pScore >= 100 && pScore < 300)
{
rankings = "Elite";
}
else
{
rankings = "Captain";
}
format(str2, sizeof(str2), "* %s %s(%d) has connected to the server from %s (GMT %d:00)", rankings, name, playerid, country, gmt);
SendClientMessageToAll(concolor,str2);
return 1;
}
|
Neither, if you have that code in OnPlayerConnect it will create that line when a player connects. Since the player hasn't had a chance to log in yet, their score will be 0.
So you could either: - Move the code to display that line after they log in / register. - Upon connecting, you can read the account data for the account score and use that instead of GetPlayerScore. - Or just not display the ranking at all. |