Help [+rep]
#1

pawn Код:
public OnPlayerConnect(playerid)
{
    if(GetPlayerScore(playerid) < 10)
    {
    new Text3D:label = Create3DTextLabel("Private",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 50)
    {
    new Text3D:label1 = Create3DTextLabel("Private First Class",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label1, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 100)
    {
    new Text3D:label2 = Create3DTextLabel("Corporal",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label2, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 200)
    {
    new Text3D:label3 = Create3DTextLabel("Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 300)
    {
    new Text3D:label4 = Create3DTextLabel("Staff Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label4, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 500)
    {
    new Text3D:label5 = Create3DTextLabel("Sergeant First Class",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label5, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) < 600)
    {
    new Text3D:label6 = Create3DTextLabel("Master Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label6, playerid, 0.0, 0.0, 0.4);
    }
    if(GetPlayerScore(playerid) >= 600)
    {
    new Text3D:label7 = Create3DTextLabel("Commander",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
    }
    // Rest of the code
I dont understand it attachs all of them can anybody help me with it??
Reply
#2

pawn Код:
public OnPlayerConnect(playerid)
{
    if(GetPlayerScore(playerid) < 10)
    {
    new Text3D:label = Create3DTextLabel("Private",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 50)
    {
    new Text3D:label1 = Create3DTextLabel("Private First Class",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label1, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 100)
    {
    new Text3D:label2 = Create3DTextLabel("Corporal",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label2, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 200)
    {
    new Text3D:label3 = Create3DTextLabel("Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label3, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 300)
    {
    new Text3D:label4 = Create3DTextLabel("Staff Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label4, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 500)
    {
    new Text3D:label5 = Create3DTextLabel("Sergeant First Class",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label5, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) < 600)
    {
    new Text3D:label6 = Create3DTextLabel("Master Sergeant",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label6, playerid, 0.0, 0.0, 0.4);
    }
    else if(GetPlayerScore(playerid) >= 600)
    {
    new Text3D:label7 = Create3DTextLabel("Commander",GREEN, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
    }
    // Rest of the code
Reply
#3

İt just shows private
Reply
#4

Make sure you understand that GetPlayerScore is the score that has been pre-defined by SA:MP (which is zero when you connect.)
You should have something that sets it (SetPlayerScore) and this should be before the current code you have in Player Connect.
Reply
#5

The code should look like this:

pawn Код:
if(GetPlayerScore(playerid) > 0 && GetPlayerScore(playerid) < 10) // Rank Private
else if(GetPlayerScore(playerid) > 10 && GetPlayerScore(playerid) < 50) // Rank First Class Private

// And so on...
Aswell as actually setting the player's score.
Reply
#6

Or
pawn Код:
switch( GetPlayerScore( playerid ) )
{
    case 0 .. 10:
    {
        // Do Something
    }
    case 11 .. 50:
    {
        // Do Something
    }
}
Reply
#7

Quote:
Originally Posted by Silentfood
Посмотреть сообщение
Make sure you understand that GetPlayerScore is the score that has been pre-defined by SA:MP (which is zero when you connect.)
You should have something that sets it (SetPlayerScore) and this should be before the current code you have in Player Connect.
You were right when i putted to onplayerspawn it actually worked.

Thanks a lot +rep
Reply
#8

Quote:
Originally Posted by lordturhan
Посмотреть сообщение
You were right when i putted to onplayerspawn it actually worked.

Thanks a lot +rep
it will still only show private unless you check if the value is in between to int's:
pawn Код:
if(GetPlayerScore(playerid) > 0 && GetPlayerScore(playerid) < 10)
Reply
#9

Thanks Cameltoe it worked +rep it had some problems
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)