08.01.2014, 18:40
So i have been working for a while on this label and it is not working, and i couldn't figure out what is wrong on it. Please i need you guys' help urgently.
I have made the rank system for truckers and added the label for each ranks depending on their score.
I want the label only show for trucker class and i did, and deleting the label when player dies is necessary. Because if a player join police or whatever other class, the rank label will show for them. But the problem i got is, it only works for 2 players. When there are like 3+ players in the server and a player dies, the label doesn't get deleted and when he/she choose police class the trucker rank label will show on their names.
Here is my code:
I have made the rank system for truckers and added the label for each ranks depending on their score.
I want the label only show for trucker class and i did, and deleting the label when player dies is necessary. Because if a player join police or whatever other class, the rank label will show for them. But the problem i got is, it only works for 2 players. When there are like 3+ players in the server and a player dies, the label doesn't get deleted and when he/she choose police class the trucker rank label will show on their names.
Here is my code:
pawn Код:
public OnPlayerSpawn(playerid)
{
// Set the missiontext based on the chosen class
switch (APlayerData[playerid][PlayerClass])
{
case ClassTruckDriver: // Truck-driver class
{
format(missiontext, sizeof(missiontext), Trucker_NoJobText); // Preset the missiontext
SetPlayerColor(playerid, ColorClassTruckDriver); // Set the playercolor (chatcolor for the player and color on the map)
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 199)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("Newbie Trucker",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
if (GetPlayerScore(playerid) >= 200 && GetPlayerScore(playerid) <= 499)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("Rookie Trucker",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
if (GetPlayerScore(playerid) >= 500 && GetPlayerScore(playerid) <= 999)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("Trusted Trucker",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
if (GetPlayerScore(playerid) >= 1000 && GetPlayerScore(playerid) <= 1999)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("Experienced Trucker",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
if (GetPlayerScore(playerid) >= 2000 && GetPlayerScore(playerid) <= 3999)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("Professional Trucker",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
if (GetPlayerScore(playerid) >= 4000)
{
APlayerData[playerid][RankLabel] = Create3DTextLabel("King Of The Road",GREEN,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(APlayerData[playerid][RankLabel], playerid, 0.0, 0.0, 0.4);
}
}
//.....
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
Delete3DTextLabel(APlayerData[playerid][RankLabel]
// Setup local variables
new VictimName[24], KillerName[24], Msg[128];
//......