public OnPlayerConnect(playerid)
{
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
GetPlayerScore(playerid);
if PlayerScore > 1
SendClientMessageToAll "%s has logged in with the rank: Newbie Trucker",pName);
if PlayerScore > 50
SenClientMessageToAll "%s has logged in with the rank: Trucker in Training",pName);
if PlayerScore > 100
SenClientMessageToAll "%s has logged in with the rank: Trucker",pName);
if PlayerScore > 250
SenClientMessageToAll "%s has logged in with the rank: Half-Experienced Trucker",pName);
if PlayerScore > 500
SenClientMessageToAll "%s has logged in with the rank: Full-Experienced Trucker",pName);
if PlayerScore > 1000
SenClientMessageToAll "%s has logged in with the rank: European Trucker",pName);
if PlayerScore > 3000
SenClientMessageToAll "%s has logged in with the rank: World European Trucker",pName);
return 1;
}
public scorechecktimer(playerid)
{
GetPlayerScore(playerid);
if PlayerScore = 1
SendClientMessageToAll "%s has reached the rank: Newbie Trucker",pName);
if PlayerScore = 50
SendClientMessageToAll "%s has reached the rank: Trucker in Training",pName);
if PlayerScore = 100
SendClientMessageToAll "%s has reached the rank: Trucker",pName);
if PlayerScore = 250
SendClientMessageToAll "%s has reached the rank: Half-Experienced Trucker",pName);
if PlayerScore = 500
SendClientMessageToAll "%s has reached the rank: Full-Experienced Trucker",pName);
if PlayerScore = 1000
SendClientMessageToAll "%s has reached the rank: European Trucker",pName);
if PlayerScore = 3000
SendClientMessageToAll "%s has reached the rank: World European Trucker",pName);
return;
}
for your first time i like it, But when the player reach their score and stay in there they gonna get spammed on the chat, a little thing, instead of just use all if's, try using else if.
as redjohn said ... now you must check and load their stats, and please show us what is the playerscore function. for now these little mistake i can see. |
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(GetPlayerScore(playerid) <= 1)
{
format(string, sizeof(string), "%s has logged in with the rank: Newbie Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 50)
{
format(string, sizeof(string), "%s has logged in with the rank: Trucker in Training", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 100)
{
format(string, sizeof(string), "%s has logged in with the rank: Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 250)
{
format(string, sizeof(string), "%s has logged in with the rank: Half-Experienced Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 500)
{
format(string, sizeof(string), "%s has logged in with the rank: Full-Experienced Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 100)
{
format(string, sizeof(string), "%s has logged in with the rank: European Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
if(GetPlayerScore(playerid) <= 3000)
{
format(string, sizeof(string), "%s has logged in with the rank: Worl European Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
return 1;
}
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME+1], string[128]; // lazy to count each cell.
GetPlayerName(playerid, pname, sizeof(pname));
if(GetPlayerScore(playerid) <= 1) {
format(string, sizeof(string), "%s has logged in with the rank: Newbie Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
else if(GetPlayerScore(playerid) > 1 && GetPlayerScore(playerid) <=50 ) {
format(string, sizeof(string), "%s has logged in with the rank: Trucker in Training", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
else if(GetPlayerScore(playerid) > 50 && GetPlayerScore(playerid) <=250 ) {
format(string, sizeof(string), "%s has logged in with the rank: Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
else if(GetPlayerScore(playerid) > 250 && GetPlayerScore(playerid) <=500 ) {
format(string, sizeof(string), "%s has logged in with the rank: Half-Experienced Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
else if(GetPlayerScore(playerid) > 500 && GetPlayerScore(playerid) <=1000 ) {
format(string, sizeof(string), "%s has logged in with the rank: Full-Experienced Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
else if(GetPlayerScore(playerid) >1000 && GetPlayerScore(playerid) <=3000 ) {
format(string, sizeof(string), "%s has logged in with the rank: European Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
else if(GetPlayerScore(playerid) > 3000 ) {
format(string, sizeof(string), "%s has logged in with the rank: Worl European Trucker", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
}
return 1;
}
Something like this, you should compare the actual score with the next score for the next rank.
pawn Код:
|