SA-MP Forums Archive
~MostWanted~ [Help Please :S] - 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: ~MostWanted~ [Help Please :S] (/showthread.php?tid=492085)



~MostWanted~ [Help Please :S] - MahdiGames - 02.02.2014

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;
    }



Re: ~MostWanted~ [Help Please :S] - Misiur - 02.02.2014

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


Re: ~MostWanted~ [Help Please :S] - MahdiGames - 02.02.2014

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?


Re: ~MostWanted~ [Help Please :S] - Konstantinos - 02.02.2014

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.


Re: ~MostWanted~ [Help Please :S] - Misiur - 02.02.2014

Oh, sorry about that duplication thingy


Re: ~MostWanted~ [Help Please :S] - MahdiGames - 02.02.2014

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


Re: ~MostWanted~ [Help Please :S] - Misiur - 02.02.2014

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.


Re: ~MostWanted~ [Help Please :S] - MahdiGames - 02.02.2014

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


Re: ~MostWanted~ [Help Please :S] - MahdiGames - 02.02.2014

Anyone can help please??


Re: ~MostWanted~ [Help Please :S] - Misiur - 02.02.2014

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