Admin's SetWorld command by using zcmd and sscanf
#6

The above example will output errors.

pawn Код:
#include <a_samp>
#include <sscanf>
#include <zcmd>

COMMAND:setvw(playerid, params[])
{
    #pragma unused params
    if (IsPlayerAdmin(playerid))
    {
        new
            targetid,
            vw;
        if (sscanf(params, "dd", targetid, vw))
        {
            SendClientMessage(playerid, -1, "Syntax: /setvw [playerid] [virtual world]");
            return 1;
        }
        if (vw < 0)
        {
            SendClientMessage(playerid, -1, "Invalid virtual world specified.");
            return 1;
        }
        if (!IsPlayerConnected(targetid))
        {
            SendClientMessage(playerid, -1, "Invalid player ID.");
            return 1;
        }
        SetPlayerVirtualWorld(targetid, vw);
        SendClientMessage(targetid, -1, "Your virtual world has been changed by an Admin.");
    }
    return 1;
}
Note that -1 in SendClientMessage is white color, so change that if you want your colors.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)