command /spec
#1

Hi Guys!

I need someone to help me to make a /spec Command ! this is to enter the command and the ID / ID spec to see which character was entered in the ID playing. I have no idea how to do this command and I hope to have your help to do it.

Thank you
Reply
#2

Do you use a goodfather based gamemode?
Reply
#3

Yes.
Reply
#4

pawn Код:
if(strcmp(cmd, "/spec", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not authorized to use that command !");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spec [playerid/off]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerNPC(giveplayerid)) return 1;
            if(strcmp("off", tmp, true, strlen(tmp)) == 0)
            {
                if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You are not spectating anyone !");
                    return 1;
                }
                SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
                SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVirtualWorld]);
                SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
                SetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
                SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
                SendClientMessage(playerid, COLOR_WHITE, "You are no longer spectating.");
                TogglePlayerSpectating(playerid, 0);
                SpectatedID[playerid] = INVALID_PLAYER_ID;
                SpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
                HidePM[playerid] = 0;
                PhoneOnline[playerid] = 0;
                WithGlasses[playerid] = 0;
                WithMask[playerid] = 0;
                WithHat[playerid] = 0;
                WithBandana[playerid] = 0;
                WithHelmet[playerid] = 0;
                ResetPlayerAdminWeaponsEx(playerid);
                return 1;
            }
            if(IsPlayerConnected(giveplayerid))
            {
                if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
                {
                    PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
                    GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
                    GetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
                    GetPlayerPos(playerid, PlayerInfo[playerid][pSPos_x], PlayerInfo[playerid][pSPos_y], PlayerInfo[playerid][pSPos_z]);
                    GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSPos_r]);
                }
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
                SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
                TogglePlayerSpectating(playerid, 1);
                SpectatedID[playerid] = giveplayerid;
                HidePM[playerid] = 1;
                PhoneOnline[playerid] = 1;
                new Float:X, Float:Y, Float:Z;
                new Float:health;
                GetPlayerHealth(giveplayerid, health);
                new Float:armor;
                GetPlayerArmour(giveplayerid, armor);GetPlayerPos(playerid, X, Y, Z);
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new cash =  GetPlayerMoney(giveplayerid);
                if (PlayerInfo[playerid][pAdmin] >= 1)
                {
                    format(string, sizeof(string), "Specing: [%d]%s [$%d] [H:%.0f] [A:%.0f]",giveplayerid,giveplayer,cash,health,armor);
                }
                SendClientMessage(playerid, COLOR_GREEN, string);
                if(IsPlayerInAnyVehicle(giveplayerid))
                {
                    PlayerSpectateVehicle(playerid, GetPlayerVehicleID(giveplayerid));
                    SpectateType[playerid] = ADMIN_SPEC_TYPE_VEHICLE;
                }
                else
                {
                    PlayerSpectatePlayer(playerid, giveplayerid);
                    SpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   That player isn't active !");
                return 1;
            }
        }
        return 1;
    }
Reply
#5

Thank you Very much !
Reply
#6

Quote:
Originally Posted by bpancakes41
Посмотреть сообщение
Thank you Very much !
You`re welcome.
If you have any problem just let me know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)