Useful Commands
#1

Hello Guys,
I was thinking that there is a Useful Functions and Useful Snippets topic so why not create a Useful Commands topic.
Then i saw a thread where a guy asked if there was a Useful Commands topic.
I got permission to create this thread from ****** so here it is.
Heres a simple /goto and /bring command required in many servers.
pawn Код:
if ( strcmp( cmd, "/goto", true ) == 0 )
    {
        new tmp[256];

        tmp = strtok( cmdtext, idx );

        if ( !strlen( tmp ) ) { return 1; }

        new Float:X, Float:Y, Float:Z;

        if ( GetPlayerVehicleID( playerid ) )
        {
            GetPlayerPos( strval(tmp), X, Y, Z );
            SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
        } else {
            GetPlayerPos( strval(tmp), X, Y, Z );
            SetPlayerPos( playerid, X+2, Y+2, Z );
        }

        return 1;
    }

    if ( strcmp( cmd, "/bring", true ) == 0 )
    {
        new tmp[256];

        tmp = strtok( cmdtext, idx );

        if ( !strlen( tmp ) ) { return 1; }

        new Float:X, Float:Y, Float:Z;

        if ( GetPlayerVehicleID( strval(tmp) ) )
        {
            GetPlayerPos( playerid, X, Y, Z );
            SetVehiclePos( GetPlayerVehicleID(strval(tmp)), X+2, Y+2, Z );
        } else {
            GetPlayerPos( playerid, X, Y, Z );
            SetPlayerPos( strval(tmp), X+2, Y+2, Z );
        }

        return 1;
    }
Reply
#2

Why not use ZCMD instead? Strcmp is old and shit.
Reply
#3

Why another topic when 'Useful Snippets' exist? Users do post commands on Useful Snippets so I don't feel another topic has to be created..
Reply
#4

well to use this you need to have ZCMD include and scccanf
pawn Код:
COMMAND:acar(playerid,params[])
{
    new Float:_X_,Float:_Y_,Float:_Z_,veh,color1,color2;
    GetPlayerPos(playerid,_X_,_Y_,_Z_);
    if (!sscanf(params, "iii", veh, color1,color2))
    {
    AddStaticVehicle(veh,_X_,_Y_,_Z_,0,color1, color2);
    }
    else SendClientMessage(playerid, COLOR_ERROR, "Usage: /veh [carid] [Color 1] [Color 2]");
    return 1;
}
Reply
#5

Quote:
Originally Posted by -Luis
Посмотреть сообщение
Why not use ZCMD instead? Strcmp is old and shit.
You can add commands in replies made of ZCMD. this is just the start
Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Why another topic when 'Useful Snippets' exist? Users do post commands on Useful Snippets so I don't feel another topic has to be created..
Maybe, but all people don't think that, and a seperate topic for cmds might be nice.
Quote:
Originally Posted by [bot]fatninja
Посмотреть сообщение
well to use this you need to have ZCMD include and scccanf
pawn Код:
COMMAND:acar(playerid,params[])
{
    new Float:_X_,Float:_Y_,Float:_Z_,veh,color1,color2;
    GetPlayerPos(playerid,_X_,_Y_,_Z_);
    if (!sscanf(params, "iii", veh, color1,color2))
    {
    AddStaticVehicle(veh,_X_,_Y_,_Z_,0,color1, color2);
    }
    else SendClientMessage(playerid, COLOR_ERROR, "Usage: /veh [carid] [Color 1] [Color 2]");
    return 1;
}
Thanks for posting something..

Waiting for ****** to sticky it.
Reply
#6

here to to dissable chat
on the top of your script
pawn Код:
new Chat = 1;
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/chat", true))
    {
        if(IsPlayerAdmin(playerid))
        {
        if(Chat == 0)
        {
        Chat = 1;
        SendClientMessage(playerid, 0xFFFFFFFF, "chat enabled");
        }
        if(Chat == 1)
        {
        Chat = 0;
        SendClientMessage(playerid, 0xFFFFFFFF, "chat disable");
        }
        }
    }
    return 0;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(Chat == 0) return 0;
}
Reply
#7

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
here to to dissable chat
on the top of your script
pawn Код:
new Chat = 1;
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/chat", true))
    {
        if(IsPlayerAdmin(playerid))
        {
        if(Chat == 0)
        {
        Chat = 1;
        SendClientMessage(playerid, 0xFFFFFFFF, "chat enabled");
        }
        if(Chat == 1)
        {
        Chat = 0;
        SendClientMessage(playerid, 0xFFFFFFFF, "chat disable");
        }
        }
    }
    return 0;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
  if(Chat == 0) return 0;
}
Dont mind but usefull commands are diffrent from usefull codes or TUT of doing something
Reply
#8

Quote:
Originally Posted by [bot]fatninja
Посмотреть сообщение
Dont mind but usefull commands are diffrent from usefull codes or TUT of doing something
okey sir.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)