Spectate
#1

Код:
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?
Reply
#2

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
Reply
#3

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

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)); }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)