/highlight cmd
#1

hello!
i need a highlight cmd for normal players (not for admins),in that players can highlight themselfs, please help me
Reply
#2

PHP код:
#define COLORMENU 1111 
PHP код:
CMD:highlight(playeridparams[])
{
   
ShowPlayerDialog(playeridCOLORMENUDIALOG_STYLE_LIST"Color Menu""Blue\nBlack\nRed\nOrange\nPink\nPurple\nGreen\nYellow\nWhite""Select""Cancel");

Use this under OnPlayerDialogResponse callback.

PHP код:
if(dialogid == COLORMENU)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
SetPlayerColor(playerid0x2641FEAA);
                
SendClientMessage(playerid0x2641FEAA"Your color has been set to Blue!");
            }
            if(
listitem == 1)
            {
                
SetPlayerColor(playerid0x000000AA);
                
SendClientMessage(playerid0x000000AA"Your color has been set to Black!");
            }
            if(
listitem == 2)
            {
                
SetPlayerColor(playerid0xAA3333AA);
                
SendClientMessage(playerid0xAA3333AA"Your color has been set to Red!");
            }
            if(
listitem == 3)
            {
                
SetPlayerColor(playerid0xFF800000);
                
SendClientMessage(playerid0xFF800000"Your color has been set to Orange!");
            }
            if(
listitem == 4)
            {
                
SetPlayerColor(playerid0xFF66FFAA);
                
SendClientMessage(playerid0xFF66FFAA"Your color has been set to Pink!");
            }
            if(
listitem == 5)
            {
                
SetPlayerColor(playerid0xC2A2DAAA);
                
SendClientMessage(playerid0xC2A2DAAA"Your color has been set to Purple!");
            }
            if(
listitem == 6)
            {
                
SetPlayerColor(playerid0x33AA33AA);
                
SendClientMessage(playerid0x33AA33AA"Your color has been set to Green!");
            }
            if(
listitem == 7)
            {
                
SetPlayerColor(playerid0xFFFF00AA);
                
SendClientMessage(playerid0xFFFF00AA"Your color has been set to Yellow!");
            }
            if(
listitem == 8)
            {
                
SetPlayerColor(playerid0xFFFFFFAA);
                
SendClientMessage(playerid0xFFFFFFAA"Your color has been set to White!");
            }
        }
    }
    return 
1;

Reply
#3

Nevermind
Reply
#4

this is a admin command and i want to change it to normal players but they can do only themselfs
pawn Код:
cmd:highlight(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
        if(isnull(params)) return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /highlight [PlayerID]") &&
        SendClientMessage(playerid, orange, "Function: Will Highlight the specified player! (Blinking)");
        new player1, playername[MAX_PLAYER_NAME], string[128];
        player1 = strval(params);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            GetPlayerName(player1, playername, sizeof(playername));
            if(PlayerInfo[player1][blip] == 0) {
                CMDMessageToAdmins(playerid,"HighLight");
                PlayerInfo[player1][pColour] = GetPlayerColor(player1);
                PlayerInfo[player1][blip] = 1;
                BlipTimer[player1] = SetTimerEx("HighLight", 1000, 1, "i", player1);
                format(string,sizeof(string),"|- You have highlighted %s's marker -|", playername);
            } else {
                KillTimer( BlipTimer[player1] );
                PlayerInfo[player1][blip] = 0;
                SetPlayerColor(player1, PlayerInfo[player1][pColour] );
                format(string,sizeof(string),"You have stopped highlighting %s's marker", playername);}
            return SendClientMessage(playerid,blue,string);
        } else return SendClientMessage(playerid, red, "Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");}


forward HighLight(playerid);
public HighLight(playerid){
    if(PlayerInfo[playerid][blipS] == 0) { SetPlayerColor(playerid, 0xFF0000AA); PlayerInfo[playerid][blipS] = 1; }
    else { SetPlayerColor(playerid, 0x33FF33AA); PlayerInfo[playerid][blipS] = 0; }
    return 0;}
Reply
#5

remove this line and it should work fine

if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
Reply
#6

Don't forget to remove this line too:

pawn Код:
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");}
Reply
#7

PHP код:
cmd:highlight(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= 2)
    {
        if(
isnull(params)) return SendClientMessage(playeridLIGHTBLUE2"Usage: /highlight [PlayerID]") &&
        
SendClientMessage(playeridorange"Function: Will Highlight the specified player! (Blinking)");
        new 
player1playername[MAX_PLAYER_NAME], string[128];
        
player1 strval(params);
        if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            
GetPlayerName(player1playernamesizeof(playername));
            if(
PlayerInfo[player1][blip] == 0) {
                
CMDMessageToAdmins(playerid,"HighLight");
                
PlayerInfo[player1][pColour] = GetPlayerColor(player1);
                
PlayerInfo[player1][blip] = 1;
                
BlipTimer[player1] = SetTimerEx("HighLight"10001"i"player1);
                
format(string,sizeof(string),"|- You have highlighted %s's marker -|"playername);
            } else {
                
KillTimerBlipTimer[player1] );
                
PlayerInfo[player1][blip] = 0;
                
SetPlayerColor(player1PlayerInfo[player1][pColour] );
                
format(string,sizeof(string),"You have stopped highlighting %s's marker"playername);}
            return 
SendClientMessage(playerid,blue,string);
        } else return 
SendClientMessage(playeridred"Player is not connected");
forward HighLight(playerid);
public 
HighLight(playerid){
    if(
PlayerInfo[playerid][blipS] == 0) { SetPlayerColor(playerid0xFF0000AA); PlayerInfo[playerid][blipS] = 1; }
    else { 
SetPlayerColor(playerid0x33FF33AA); PlayerInfo[playerid][blipS] = 0; }
    return 
0;} 
Reply
#8

But if i remove those lines then normal players can do that cmd upon other players for eg: /highlight [id]
I wanted to make just /highlight (me)
Reply
#9

pawn Код:
cmd:highlight(playerid,params[])
{
    if ( !isnull ( params ) ) return SendClientMessage(playerid, LIGHTBLUE2, #Usage: /highlight );
    SendClientMessage( playerid, orange, #Function: Will Highlight yourself );
    if ( PlayerInfo[ playerid ][ blip ] == 0 )
    {
        CMDMessageToAdmins( playerid, "HighLight" );
        PlayerInfo[ playerid ][ pColour ] = GetPlayerColor( playerid );
        PlayerInfo[ playerid ][ blip ] = 1;
        BlipTimer[ playerid ] = SetTimerEx( "HighLight", 1000, 1, "i", playerid );
        SendClientMessage( playerid, -1, #You have highlighted yourself );
    }
    else
    {
        KillTimer( BlipTimer[ playerid ] );
        PlayerInfo[ playerid ][ blip ] = 0;
        SetPlayerColor( playerid, PlayerInfo[ playerid ][ pColour ] );
        SendClientMessage( playerid, -1, #You have stopped highlighting yourself );
    }
    return ( true );
}


forward HighLight(playerid);
public HighLight(playerid)
{
    if ( PlayerInfo[ playerid ][ blipS ] == 0 )
    {
        SetPlayerColor( playerid, 0xFF0000AA ); PlayerInfo[ playerid ][ blipS ] = 1;
    }
    else
    {
        SetPlayerColor( playerid, 0x33FF33AA ); PlayerInfo[ playerid ][ blipS ] = 0;
    }
    return ( false );
}
Reply
#10

Quote:
Originally Posted by RBTDM
Посмотреть сообщение
But if i remove those lines then normal players can do that cmd upon other players for eg: /highlight [id]
I wanted to make just /highlight (me)
use the code i gave you above.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)