need help with /wanted
#1

well i try making /wanted that shows poeple that are wanted and failed, can you guys help?
pawn Код:
CMD:wanted(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        SendClientMessage(playerid,orange,"Wanted List");
        GetPlayerWantedLevel(playerid);
    }
    else return 0;
    return 1;
}
Reply
#2

pawn Код:
CMD:wanted(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        new str[128], name[MAX_PLAYER_NAME];
        SendClientMessage(playerid,orange,"Wanted List");
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerWantedLevel(i) >= 1)
            {
                GetPlayerName(i, name, sizeof name);
                format(str, sizeof str, "%s - Wanted Level: %d", name, GetPlayerWantedLevel(i));
                SendClientMessage(playerid, str);
            }
        }
    }
    else return SendClientMessage(playerid, 0xFFFFFF, "You are not a law enforcement");
    return 1;
}
I quite forgot how to display all names, but you don't know if it works if you don't try
Reply
#3

pawn Код:
CMD:wanted(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        SendClientMessage(playerid,orange,"Wanted List");
        for(new i; i < MAX_PLAYERS; i++)
        {
            GetPlayerName(i,Nam, sizeof(Nam));
            if(GetPlayerWantedLevel(i) >= 1)
            {
                format(str, sizeof str, "%s - Wanted Level: %d",Nam, GetPlayerWantedLevel(i));
                SendClientMessage(playerid,orange, str);
            }
            else return SendClientMessage(playerid,red,"Nobody is wanted right now!");
        }
    }
    else return 0;
    return 1;
}
How can i make it says there is no body wanted, i want someone and it shows nobody wanted still. When i use /wanted while nobody wanted it shows wanted list and nobody is wanted!
Reply
#4

pawn Код:
CMD:wanted(playerid,params[])
{
    if(PlayerData[playerid][IsLaw] == 1)
    {
        new count;
        SendClientMessage(playerid,orange,"Wanted List");
        for(new i; i < MAX_PLAYERS; i++)
        {
            GetPlayerName(i,Nam,sizeof(Nam));
            if(GetPlayerWantedLevel(i) > 0)
            {
                count++;
                format(str, sizeof str, "%s - Wanted Level: %d",Nam, GetPlayerWantedLevel(i));
                SendClientMessage(playerid,orange, str);
            }
        }
        if(count == 0) SendClientMessage(playerid,red,"Nobody is wanted right now!");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)