SA-MP Forums Archive
[Pedido] Sistema de spec para admin. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Sistema de spec para admin. (/showthread.php?tid=405451)



Sistema de spec para admin. - RafaScripter - 06.01.2013

bom queria o comando /spec id , o adm olha o player e quando der /specoff o player volta para a posiзгo que estava antes. ajuda ae pessoal.


Re: Sistema de spec para admin. - Lуs - 06.01.2013

TogglePlayerSpectating


Re: Sistema de spec para admin. - HeyHoLetsGo - 06.01.2013

pawn Код:
CMD:mp(spect, params[])
{
    new id;
    new bool:Spectating;
    if(sscanf(params, "u",id))
    {
        SendClientMessage(playerid,-1,"[ ! ] Use: /spect [id]");
    }
    else
    {
        if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "[ ! ]Este jogador nгo estб conectado");
        if(Specting == 0)
        {
            new name[MAX_PLAYER_NAME],string[50];
            GetPlayerName(id,name,MAX_PLAYER_NAME);
            format(string,sizeof(string),"[ ! ] Observando %s.",name);
            SendClientMessage(playerid,-1,string);
            TogglePlayerSpectating(id, 1);
            Spectating == true;
        }
        else
        {
            TogglePlayerSpectating(id, 0);
            Spectating == false;
            SendClientMessage(playerid,-1,"[ ! ] Vocк nгo estб mais observando o player.");
        }
    }
    return 1;
}



Re: Sistema de spec para admin. - Lуs - 06.01.2013

Quote:
Originally Posted by HeyHoLetsGo
Посмотреть сообщение
pawn Код:
CMD:mp(spect, params[])
{
    new id;
    new bool:Spectating;
    if(sscanf(params, "u",id))
    {
        SendClientMessage(playerid,-1,"[ ! ] Use: /spect [id]");
    }
    else
    {
        if(IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "[ ! ]Este jogador nгo estб conectado");
        if(Specting == 0)
        {
            new name[MAX_PLAYER_NAME],string[50];
            GetPlayerName(id,name,MAX_PLAYER_NAME);
            format(string,sizeof(string),"[ ! ] Observando %s.",name);
            SendClientMessage(playerid,-1,string);
            TogglePlayerSpectating(id, 1);
            Spectating == true;
        }
        else
        {
            TogglePlayerSpectating(id, 0);
            Spectating == false;
            SendClientMessage(playerid,-1,"[ ! ] Vocк nгo estб mais observando o player.");
        }
    }
    return 1;
}
Complicou demais para uma coisa simples e ainda tem alguns erros.

pawn Код:
CMD:mp(spect, params[])
{
    new
        id,
        bool:Spectating[MAX_PLAYERS];

    if(sscanf(params, "u",id))
        return SendClientMessage(playerid,-1,"[ ! ] Use: /spect [id]");
   
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, -1, "[ ! ]Este jogador nгo estб conectado");
   
    if(!Specting[playerid])
    {
        new name[MAX_PLAYER_NAME],string[50];
        GetPlayerName(id,name,MAX_PLAYER_NAME);
        format(string,sizeof(string),"[ ! ] Observando %s.",name);
        SendClientMessage(playerid,-1,string);
        TogglePlayerSpectating(id, 1);
        Spectating[playerid] == true;
        return 1;
    }
    else
    {
        TogglePlayerSpectating(id, 0);
        Spectating[playerid] == false;
        SendClientMessage(playerid,-1,"[ ! ] Vocк nгo estб mais observando o player.");
        return 1;
    }

    return 1;
}
Compare


Re: Sistema de spec para admin. - RafaScripter - 06.01.2013

mais eu quero tipo assim quando para de olhar o outro player volta para a posiзгo q tava antes os comandos q vcs passaram spawnar dps de parar de ohlar


Re: Sistema de spec para admin. - Equipe - 06.01.2013

Bom cara acho que posso te ajudar ..
Porem й com strcmp ..

PHP код:
if(strcmp(cmd"/spec"true) == 0) {
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
format(filesizeof(file), PASTA_CONTASaname);
if(
pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == 5){            // <<< Isso aki й a variavel do Admin
new tmp[256];
tmp strtok(cmdtextidx);
if(!
strlen(tmp)) {
SendClientMessage(playeridVermelho"(ERRO) Digite: /spec [id]");
return 
1;
}
specplayerid strval(tmp);
if(!
IsPlayerConnected(specplayerid)) {
SendClientMessage(playeridVermelho"(ERRO) ID Invбlido.");
return 
1;
}
TogglePlayerSpectating(playerid1);
PlayerSpectatePlayer(playeridspecplayerid);
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
gSpectateID[playerid] = specplayerid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
return 
1;
}

Agora o Comando para Parar de Espiar

PHP код:
if(strcmp(cmd"/pararspec"true) == 0) {
new 
aname[MAX_PLAYER_NAME];
GetPlayerName(playeridanameMAX_PLAYER_NAME);
format(filesizeof(file), PASTA_CONTASaname);
if(
pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == || pAdmin[playerid] == 5){             // << Variavel do admin
TogglePlayerSpectating(playerid0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
return 
1;
}




Re: Sistema de spec para admin. - Lуs - 06.01.2013

Quote:
Originally Posted by RafaScripter
Посмотреть сообщение
mais eu quero tipo assim quando para de olhar o outro player volta para a posiзгo q tava antes os comandos q vcs passaram spawnar dps de parar de ohlar
pawn Код:
new
    Float:flo_position[3];//Global

CMD:mp(spect, params[])
{
    new
        id,
        bool:Spectating[MAX_PLAYERS];

    if(sscanf(params, "u",id))
        return SendClientMessage(playerid,-1,"[ ! ] Use: /spect [id]");
   
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, -1, "[ ! ]Este jogador nгo estб conectado");
   
    if(!Specting[playerid])
    {
        GetPlayerPos(playerid, flo_position[0], flo_position[1], flo_position[2]);
        new name[MAX_PLAYER_NAME],string[50];
        GetPlayerName(id,name,MAX_PLAYER_NAME);
        format(string,sizeof(string),"[ ! ] Observando %s.",name);
        SendClientMessage(playerid,-1,string);
        TogglePlayerSpectating(id, 1);
        Spectating[playerid] == true;
        return 1;
    }
    else
    {
        SetPlayerPos(playerid, flo_position[0], flo_position[1], flo_position[2]);
        TogglePlayerSpectating(id, 0);
        Spectating[playerid] == false;
        SendClientMessage(playerid,-1,"[ ! ] Vocк nгo estб mais observando o player.");
        return 1;
    }

    return 1;
}



Re: Sistema de spec para admin. - Larceny - 06.01.2013

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid, "isSpectating") == 2)
    {
        SetPlayerInterior(playerid, GetPVarInt(playerid, "specInt"));
        SetPlayerPos(playerid, GetPVarFloat(playerid, "specPosX"), GetPVarFloat(playerid, "specPosY"), GetPVarFloat(playerid, "specPosZ"));

        DeletePVar(playerid, "isSpectating");
        DeletePVar(playerid, "specPosX");
        DeletePVar(playerid, "specPosY");
        DeletePVar(playerid, "specPosZ");
        DeletePVar(playerid, "specInt");
    }
    return 1;
}

CMD:spec(playerid, params[])
{
    new targetid;

    if(sscanf(params, "u", targetid))
    {
        if(GetPVarInt(playerid, "isSpectating"))
        {
            SetPVarInt(playerid, "isSpectating", 2);
            TogglePlayerSpectating(playerid, 0);
            return 1;
        }
        SendClientMessage(playerid, -1, "* /spec [id]");
        return 1;
    }
   
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, -1, "* Este jogador nгo estб conectado");
   
    if(!GetPVarInt(playerid, "isSpectating"))
    {
        new Float:fPos[3];
        GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);

        SetPVarFloat(playerid, "specPosX", fPos[0]);
        SetPVarFloat(playerid, "specPosY", fPos[1]);
        SetPVarFloat(playerid, "specPosZ", fPos[2]);
        SetPVarInt(playerid, "specInt", GetPlayerInterior(playerid));
        SetPVarInt(playerid, "isSpectating", 1);

        TogglePlayerSpectating(playerid, 1);
        PlayerSpectatePlayer(playerid, targetid);
    }
    else
    {
        SendClientMessage(playerid, -1, "* Vocк jб estб observando alguйm. [/spec para sair]");
    }
    return 1;
}



Respuesta: Re: Sistema de spec para admin. - DKDarkking - 27.05.2015

Quote:
Originally Posted by Larceny
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid, "isSpectating") == 2)
    {
        SetPlayerInterior(playerid, GetPVarInt(playerid, "specInt"));
        SetPlayerPos(playerid, GetPVarFloat(playerid, "specPosX"), GetPVarFloat(playerid, "specPosY"), GetPVarFloat(playerid, "specPosZ"));

        DeletePVar(playerid, "isSpectating");
        DeletePVar(playerid, "specPosX");
        DeletePVar(playerid, "specPosY");
        DeletePVar(playerid, "specPosZ");
        DeletePVar(playerid, "specInt");
    }
    return 1;
}

CMD:spec(playerid, params[])
{
    new targetid;

    if(sscanf(params, "u", targetid))
    {
        if(GetPVarInt(playerid, "isSpectating"))
        {
            SetPVarInt(playerid, "isSpectating", 2);
            TogglePlayerSpectating(playerid, 0);
            return 1;
        }
        SendClientMessage(playerid, -1, "* /spec [id]");
        return 1;
    }
   
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID)
        return SendClientMessage(playerid, -1, "* Este jogador nгo estб conectado");
   
    if(!GetPVarInt(playerid, "isSpectating"))
    {
        new Float:fPos[3];
        GetPlayerPos(playerid, fPos[0], fPos[1], fPos[2]);

        SetPVarFloat(playerid, "specPosX", fPos[0]);
        SetPVarFloat(playerid, "specPosY", fPos[1]);
        SetPVarFloat(playerid, "specPosZ", fPos[2]);
        SetPVarInt(playerid, "specInt", GetPlayerInterior(playerid));
        SetPVarInt(playerid, "isSpectating", 1);

        TogglePlayerSpectating(playerid, 1);
        PlayerSpectatePlayer(playerid, targetid);
    }
    else
    {
        SendClientMessage(playerid, -1, "* Vocк jб estб observando alguйm. [/spec para sair]");
    }
    return 1;
}
nгo consigo sair do spec '-'