~MostWanted~ [Help Please :S]
#1

Hello , i want to make that if player have 5 Wanted levels to CreatePlayer3DTextLabel for player which says "-Most Wanted-" , i tried to make a timer but this did lag and ms i really stucked :S any ideas?
here is my code
Код:
   	if(strcmp(cmdtext, "/mostwanted", true) == 0)
    {
    new count = 1, name[24];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        GetPlayerWantedLevel(i);
        if(GetPlayerWantedLevel(i) >= 5)
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "%s%s (%d) - Wanted Level: %d\n", string, name,i,GetPlayerWantedLevel(i));
            count ++;
        }
    }
    if(count != 1)
    {
        ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", string, "OK", "");
    }
    else ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", "No online wanted players.", "OK", "");
    return 1;
    }
Reply
#2

pawn Код:
new Text3D:Some3DStorage[MAX_PLAYERS];

//(...)

if(strcmp(cmdtext, "/mostwanted", true) == 0)
{
    new
        count = 0,
        name[24],
        wl = 0;
       
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) {
            wl = GetPlayerWantedLevel(i);
            if(wl >= 5)
            {
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s%s (%d) - Wanted Level: %d\n", string, name, i, wl);
                count++;

                Some3DStorage[i] = Create3DTextLabel("~ Most wanted ~", 0xBADA55AA, 0, 0, 0, 100.0, 0);
                Attach3DTextLabelToPlayer(Some3DStorage[i], i, 0.0, 0.0, 0.8);
            }
        }
    }
    if(!count) strcat((string[0] = EOS, string), "No online wanted players.");
   
    ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", string, "OK", "");
    return 1;
}
Something like this
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
new Text3D:Some3DStorage[MAX_PLAYERS];

//(...)

if(strcmp(cmdtext, "/mostwanted", true) == 0)
{
    new
        count = 0,
        name[24],
        wl = 0;
       
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) {
            wl = GetPlayerWantedLevel(i);
            if(wl >= 5)
            {
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s%s (%d) - Wanted Level: %d\n", string, name, i, wl);
                count++;

                Some3DStorage[i] = Create3DTextLabel("~ Most wanted ~", 0xBADA55AA, 0, 0, 0, 100.0, 0);
                Attach3DTextLabelToPlayer(Some3DStorage[i], i, 0.0, 0.0, 0.8);
            }
        }
    }
    if(!count) strcat((string[0] = EOS, string), "No online wanted players.");
   
    ShowPlayerDialog(playerid, 26, DIALOG_STYLE_MSGBOX, "Most Wanted Players Online", string, "OK", "");
    return 1;
}
Something like this
First Thanks for trying to help, but i think the Create3DTextLabel will working just if you write /mostwanted right?
Reply
#4

Quote:
Originally Posted by MahdiGames
Посмотреть сообщение
First Thanks for trying to help, but i think the Create3DTextLabel will working just if you write /mostwanted right?
Yes and if you keep typing that command, many 3D labels will appear above the player's head.

The best option (atleast for me) would be to check if the wanted level is more than 5 or equal to 5 to the place you increase the wanted level because a timer seems a bad idea just for that.
Reply
#5

Oh, sorry about that duplication thingy
Reply
#6

I know, so how to make a function which will appear 1 time with out commands with out timers
Reply
#7

Well, somewhere in your code you have some command which gives player a wanted level. So - search for SetPlayerWantedLevel, and create/delete corresponding 3d labels.
Reply
#8

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Well, somewhere in your code you have some command which gives player a wanted level. So - search for SetPlayerWantedLevel, and create/delete corresponding 3d labels.
If can i do that i never try to post here :P
Reply
#9

Anyone can help please??
Reply
#10

Can't help you if you don't put any effort into trying. At least show command setting wanted level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)