SA-MP Forums Archive
Help [+rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help [+rep] (/showthread.php?tid=312909)



Help [+rep] - lordturhan - 23.01.2012

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??


Re: Help [+rep] - Silentfood - 23.01.2012

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



Re: Help [+rep] - lordturhan - 23.01.2012

İt just shows private


Re: Help [+rep] - Silentfood - 23.01.2012

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.


Re: Help [+rep] - Cameltoe - 23.01.2012

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.


Re: Help [+rep] - Konstantinos - 23.01.2012

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



Re: Help [+rep] - lordturhan - 23.01.2012

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


Re: Help [+rep] - Cameltoe - 23.01.2012

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)



Re: Help [+rep] - lordturhan - 23.01.2012

Thanks Cameltoe it worked +rep it had some problems