Simple rank system
#1

Guys I made a simple rank system, this is my first script, but I want to check you what I need more, or to change.
Please leave your ideas/improvements.

PHP код:
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;

It sends message when player comes online with the rank, and when player gets new rank, I hope?

plz let me know what I need to add more, or change.

Thanks
Reply
#2

It's not SenClientMessageToAll it's SendClientMessageToAll. Check it at player connect from 50 to 3000 score!

And your forgot 1 at the return; at public scorechecktimer
Reply
#3

Be careful, '=' is assignment while '==' is comparative.
You should write: if PlayerScore == 1 instead of if PlayerScore = 1

And also, everytime your players connect, their score is 0, so you should create a system that save the score of the player at disconnecting, and retrieves it al connecting (I recommend you to use Y_INI from YSI includes)
Reply
#4

okey thank guys i changed it
Reply
#5

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.
Reply
#6

Also add forward scorechecktimer(playerid);
Reply
#7

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
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.
yes I think it gets spammed when player reach a score like: 1, but how can I resolve this?7
What do u mean with this:
and please show us what is the playerscore function. ??

I just want a message when player comes online its show the rank,
And when player reached a score, it send message that he is promoted to a new rank. (once)
Reply
#8

I created this one for joining message, when he join it will check his score and it will show message!

pawn Код:
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;
}
Reply
#9

Something like this, you should compare the actual score with the next score for the next rank.
pawn Код:
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;
}
Reply
#10

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
Something like this, you should compare the actual score with the next score for the next rank.
pawn Код:
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;
}
Ohhhh I get it now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)