/Jackass
#1

I need help to make an command =/

Like: When an player type /Jackass then his skin changes to Skin ID: 252
And then should this show up in the Text like evryone can see it: PLAYER_NAME(ID) Is an Jackass!!!

And and admin can type this /Jackass [ID] then should this show up in the Text like evryone can see it: PLAYER_NAME(ID) Is an Jackass!!! + his skin changes to Skin ID: 252

Please make two differnet scripts
Reply
#2

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/jackass", true) == 0)
    {
        // Set the player's skin to ID 252, which is a whatever the skin is
        SetPlayerSkin(playerid, 252);

        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));

        new messege[128];
        format(messege,sizeof(messege), "%s(%d) Is a Jackass!!!", name, playerid); 
        SendClientMessageToAll(0xDEEE20FF, messege");
        return 1;
    }
    return 0;
}
thats the basics, its not hard to figure out the rest, just look at the wiki
Reply
#3

Thanks! Ill will try to figure out the rest
Reply
#4

Ill dont get it, i have looked at the Wiki but i dont find anything can you please make the commands for admin too? like ill explained at the first post!


And what fit best:. RandomName(0)Has gone Jackass
--------------.---- RandomName(0)Is an Jackass
My english isent soo good =/
Reply
#5

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Ill dont get it, i have looked at the Wiki but i dont find anything can you please make the commands for admin too? like ill explained at the first post!


And what fit best:. RandomName(0)Has gone Jackass
--------------.---- RandomName(0)Is an Jackass
My english isent soo good =/
ur meaning like /adminjackass so admin changes to or admin only can do /jackass ?
Reply
#6

Quote:
Originally Posted by Kitten
Посмотреть сообщение
ur meaning like /adminjackass so admin changes to or admin only can do /jackass ?
No, Like: /Jackass [ID] then should this show up in the Text like evryone can see it: PLAYER_NAME(ID) Is an Jackass!!! + his skin changes to Skin ID: 252

Sorry for my bad english =/
Reply
#7

EDIT: Code not tested

Ok look i think this is what u mean

If u are admin (logged in as rcon )
you can do /jackass id for example /jackass 2 changes the playerid of 2 into jackass am i right so then heres the code
u need strtok i included it in the code

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new
    index,
    cmd[20];
    cmd = strtok(cmdtext, index);
    if (strcmp(cmd, "/jackass", true) == 0)
    {
        new
        tmp[20],
        id;
        tmp = strtok(cmdtext, index);
        if (strlen(tmp))
        {
            id = strval(tmp);
            if (IsPlayerConnected(id))
            if(IsPlayerAdmin(playerid))
            {
                SetPlayerSkin(playerid,252);
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                new messege[128];
                format(messege,sizeof(messege), "%s(%d) Is a Jackass!!!", name, playerid);
                SendClientMessageToAll(0xDEEE20FF,messege);
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Player not found");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jackass <playerid>\"");
        }
        return 1;
    }
    return 0;
}

// You need strtok for this to work

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

PLEASE REPLY IF IT WORKS
Reply
#8

Quote:
Originally Posted by Kitten
Посмотреть сообщение
EDIT: Code not tested

Ok look i think this is what u mean

If u are admin (logged in as rcon )
you can do /jackass id for example /jackass 2 changes the playerid of 2 into jackass am i right so then heres the code
u need strtok i included it in the code

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new
    index,
    cmd[20];
    cmd = strtok(cmdtext, index);
    if (strcmp(cmd, "/jackass", true) == 0)
    {
        new
        tmp[20],
        id;
        tmp = strtok(cmdtext, index);
        if (strlen(tmp))
        {
            id = strval(tmp);
            if (IsPlayerConnected(id))
            if(IsPlayerAdmin(playerid))
            {
                SetPlayerSkin(playerid,252);
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                new messege[128];
                format(messege,sizeof(messege), "%s(%d) Is a Jackass!!!", name, playerid);
                SendClientMessageToAll(0xDEEE20FF,messege);
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Player not found");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jackass <playerid>\"");
        }
        return 1;
    }
    return 0;
}

// You need strtok for this to work

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

PLEASE REPLY IF IT WORKS
It dont work, when i /Jackass 1 it only change my skin, it dont change the skin on the player i watnt to change skin,

Sorry for bad english
Reply
#9

pawn Код:
COMMAND:jackass( playerid, params [ ] )
{
    if ( IsPlayerAdmin ( playerid ) )
    {
        new tPlayer;
        if ( sscanf ( params, "u", tPlayer ) ) SendClientMessage ( playerid, 0xFFFFFFAA, "Usage : * ^ /jackass [ playerid | playername ] ^ * " );
        else if ( tPlayer == INVALID_PLAYER_ID ) SendClientMessage ( playerid, 0xFFFFFFAA, "The selected player is not online " );
        else
        {
            new
                string [ 35 + MAX_PLAYER_NAME ],
                pName [ MAX_PLAYER_NAME ];

            GetPlayerName           ( tPlayer, pName, sizeof ( pName ) );
            format                  ( string, sizeof ( string ), "%s ( %d ) is a jackass ! " , pName, tPlayer );
            SendClientMessageToAll  ( 0xFFFFFFAA, string );

            format                  ( string, sizeof ( string ), "You have made %s ( %d ) a jackass. ", pName, tPlayer );
            SendClientMessage       ( playerid, 0xFFFFFFAA, string );

            GetPlayerName           ( playerid, pName, sizeof ( pName ) );
            format                  ( string, sizeof ( string ), "%s ( %d ) has made you a jackass. ", pName, playerid );
            SendClientMessage       ( tPlayer, 0xFFFFFFAA, string );
        }
    }
    else
    {
        new
            string [ 25 + MAX_PLAYER_NAME ],
            pName [ MAX_PLAYER_NAME ];

        GetPlayerName       ( playerid, pName, sizeof ( pName ) );
        format                  ( string, sizeof ( string ), "%s ( %d ) is a jackass ! ", pName, playerid );
        SendClientMessageToAll  ( 0xFFFFFFAA, string );
    }
    return 1;
}
Not tested
Reply
#10

You're a total
Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Jackass
.

I doubt that you even know what the meaning of 'Jackass' is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)