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
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
if(GetPlayerScore(playerid) > 0 && GetPlayerScore(playerid) < 10) // Rank Private
else if(GetPlayerScore(playerid) > 10 && GetPlayerScore(playerid) < 50) // Rank First Class Private
// And so on...
switch( GetPlayerScore( playerid ) )
{
case 0 .. 10:
{
// Do Something
}
case 11 .. 50:
{
// Do Something
}
}
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 |
if(GetPlayerScore(playerid) > 0 && GetPlayerScore(playerid) < 10)