SA-MP Forums Archive
Spectate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spectate (/showthread.php?tid=407800)



Spectate - Louris - 15.01.2013

Код:
CMD:stebeti(playerid, params[])
{
   new id, vardas[25];
   if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "Jūs ne administratorius"); //Jeigu zaidejas ne adminas tada jam nusiuncia sia zinute. As naudoju PVarInt o jus galite naudoti kintamuosius. O jeigu pas jus grp modas tada naudokite ten PlayerDb[playerid]... Kazkaip ten :D
   if(sscanf(params, "r", id)) return SendClientMessage(playerid, 0xFF9900, "Naudojimas: /stebeti [Nickas]"); //Jeigu zaidejas iraso neteisingai komanda tada jam nusiuncia sia zinute.
   if(!IsPlayerConnected(id))   return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidėjo nėra");//Patikrina ar zaidejas prisijunges.
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidėjo nėra");//Patikrina ar vardas irasytas teisingai.
    if(IsPlayerNPC(id)) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidėjo nėra");//Patikrina ar ivestas zaidejas nera NPC botas.
    if(id == playerid) return SendClientMessage(playerid,0xFF0000AA,"Jūs negalite stebėti savęs!"); //Patikrina ar zaidejas neisirase savo nicko.
      new msg[100]; //Stringas zinutei.
      GetPlayerName(playerid, vardas, sizeof(vardas)); //Gauna zaidejo varda.
      SetCameraBehindPlayer(id);//Nustato zaidejo cameros pozicija uz to zaidejo kuri jis irase.
      format(msg, sizeof(msg), "Stebite ћaidėją %s. Norėdami baigti raљykite /baigti", vardas); //Formatinam sita zinute.
      SendClientMessage(playerid, 0xFFFF00AA, msg);//Nusiunciam suformatinta zinute.
                return 1;
}
This cmd is bugged. When i try to someone spectate, i spectate myself.. Can someone give me simple spectate cmd without bugs?


Re: Spectate - NicholasA - 15.01.2013

pawn Код:
CMD:stebeti(playerid, params[])
{
    new id, vardas[25];
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "Jus ne administratorius"); //Jeigu zaidejas ne adminas tada jam nusiuncia sia zinute. As naudoju PVarInt o jus galite naudoti kintamuosius. O jeigu pas jus grp modas tada naudokite ten PlayerDb[playerid]... Kazkaip ten :D
    if(sscanf(params, "r", id)) return SendClientMessage(playerid, 0xFF9900, "Naudojimas: /stebeti [Nickas]"); //Jeigu zaidejas iraso neteisingai komanda tada jam nusiuncia sia zinute.
    if(!IsPlayerConnected(id))   return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar zaidejas prisijunges.
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar vardas irasytas teisingai.
    if(IsPlayerNPC(id)) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar ivestas zaidejas nera NPC botas.
    if(id == playerid) return SendClientMessage(playerid,0xFF0000AA,"Jus negalite stebeti saves!"); //Patikrina ar zaidejas neisirase savo nicko.
    new msg[100]; //Stringas zinutei.
    GetPlayerName(playerid, vardas, sizeof(vardas)); //Gauna zaidejo varda.
    SetCameraBehindPlayer(id);//Nustato zaidejo cameros pozicija uz to zaidejo kuri jis irase.
    format(msg, sizeof(msg), "Stebite ћaideja %s. Noredami baigti raљykite /baigti", vardas); //Formatinam sita zinute.
    SendClientMessage(playerid, 0xFFFF00AA, msg);//Nusiunciam suformatinta zinute.
    return 1;
}
Also, specing yourself is not possible


Re: Spectate - Louris - 15.01.2013

Possible.. This cmd is bugged, i try to spectate someone, and it write my nick, and i can't spectate anyone.


AW: Re: Spectate - Elorreli - 15.01.2013

Quote:
Originally Posted by phantomcraft
Посмотреть сообщение
pawn Код:
CMD:stebeti(playerid, params[])
{
    new id, vardas[25];
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "Jus ne administratorius"); //Jeigu zaidejas ne adminas tada jam nusiuncia sia zinute. As naudoju PVarInt o jus galite naudoti kintamuosius. O jeigu pas jus grp modas tada naudokite ten PlayerDb[playerid]... Kazkaip ten :D
    if(sscanf(params, "r", id)) return SendClientMessage(playerid, 0xFF9900, "Naudojimas: /stebeti [Nickas]"); //Jeigu zaidejas iraso neteisingai komanda tada jam nusiuncia sia zinute.
    if(!IsPlayerConnected(id))   return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar zaidejas prisijunges.
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar vardas irasytas teisingai.
    if(IsPlayerNPC(id)) return SendClientMessage(playerid, 0xFF0000AA, "Tokio ћaidejo nera");//Patikrina ar ivestas zaidejas nera NPC botas.
    if(id == playerid) return SendClientMessage(playerid,0xFF0000AA,"Jus negalite stebeti saves!"); //Patikrina ar zaidejas neisirase savo nicko.
    new msg[100]; //Stringas zinutei.
    GetPlayerName(playerid, vardas, sizeof(vardas)); //Gauna zaidejo varda.
    SetCameraBehindPlayer(id);//Nustato zaidejo cameros pozicija uz to zaidejo kuri jis irase.
    format(msg, sizeof(msg), "Stebite ћaideja %s. Noredami baigti raљykite /baigti", vardas); //Formatinam sita zinute.
    SendClientMessage(playerid, 0xFFFF00AA, msg);//Nusiunciam suformatinta zinute.
    return 1;
}
Also, specing yourself is not possible
This is stupid, remove SetCameraBehindPlayer (obviously) and add this:

pawn Код:
TogglePlayerSpectating(playerid, 1);
if(!IsPlayerInAnyVehicle(id)) { PlayerSpectatePlayer(playerid, id); }
else { PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id)); }