LEVEL SYSTEM(dosn't work)
#1

Hi i tryed to create a level system but it dosn't work level just up innto 1 and thats all.
new Text:Textdraw2;
new lygis[150];
ongamemodeinit
Код:
Textdraw2 = TextDrawCreate(521.000000, 139.000000, "LYGIS:~r~"); TextDrawBackgroundColor(Textdraw2, 255); TextDrawFont(Textdraw2, 1); TextDrawLetterSize(Textdraw2, 0.600000, 2.000000); TextDrawColor(Textdraw2,-572662273); TextDrawSetOutline(Textdraw2, 1); TextDrawSetProportional(Textdraw2, 1);
onplayerconnect

Quote:
Quote:
Код:
	 SetTimer("LEVEL", 60000, true);
onplayerspawn
Код:
    new string[ 128 ];
    if(GetPlayerScore(playerid) >=200)
    {
        lygis = "5"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 8000 && GetPlayerScore(playerid) < 15000)
    {
        lygis = "4"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 5000 && GetPlayerScore(playerid) < 7999)
    {
        lygis = "3"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 2001 && GetPlayerScore(playerid) < 4999)
    {
        lygis = "2"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 199 && GetPlayerScore(playerid) < 2000)
    {
        lygis = "1"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) < 199)
    {
        lygis = "0"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    format( string, sizeof string, "~y~LYGIS:~w~ %s",lygis);
    TextDrawSetString(Textdraw2, string);
    TextDrawShowForPlayer( playerid, Textdraw2 );

and timer

Код:
forward LYGIS(playerid);
public LYGIS(playerid)
{
    new string[ 128 ];
    if(GetPlayerScore(playerid) >=200)
    {
        lygis = "5"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 8000 && GetPlayerScore(playerid) < 15000)
    {
        lygis = "4"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 5000 && GetPlayerScore(playerid) < 7999)
    {
        lygis = "3"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 2001 && GetPlayerScore(playerid) < 4999)
    {
        lygis = "2"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 199 && GetPlayerScore(playerid) < 2000)
    {
        lygis = "1"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    else if(GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) < 199)
    {
        lygis = "0"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
    format( string, sizeof string, "~y~LYGIS:~w~ %s",lygis);
    TextDrawSetString(Textdraw2, string);
    TextDrawShowForPlayer( playerid, Textdraw2 );
    return 1;
}
[/HTML][/HTML]
Whats wrong why dosn't workt?
Reply
#2

You said it goes to rank 1 and none of the others. Well, I spotted what appears to be one error but it is unrelated to being set to rank 1. You said that if the player's score is > 200 then their rank would be 5. This line basically contradicts everything you have written below it.

This is the line I am talking about:

Код:
    if(GetPlayerScore(playerid) >=200)
    {
        lygis = "5"; /// The rank name
        TextDrawSetString(Textdraw2, string);
    }
Reply
#3

Thx, but then i fixed i get up level and anothor player gets to why?
Reply
#4

Quote:
Originally Posted by sn0p
Посмотреть сообщение
Thx, but then i fixed i get up level and anothor player gets to why?
I really don't understand what you're trying to tell me. Please elaborate.
Reply
#5

sorry for my bad english, i fixed that error, and i had created system when you kill player get some exp, so i killed anothore player and i up level to 2, he to and for him show level:2 and for my why?
Reply
#6

Oops - I completely overlooked what you were trying to create.

You are using global textdraws when you should be using player textdraws. Basically, with a global textdraw you have one textdraw that is the same for every player. A player textdraw on the other hand can be different for each player.

I'll refer you to the wiki: https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw

Note: Don't hold me to this information - I have only recently gotten back to SA:MP (two days ago) and I'm still familiarizing myself with a few features.
Reply
#7

Thx for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)