Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C# by wd ( 16 years ago )
#include <a_samp>
dcmd_spec(playerid, params[])
{
//if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000AA,"Brak dostępu"); // komenda tylko dla admina
if(!strlen(params))return SendClientMessage(playerid,0xFFFFFFAA,"użyj /spec [id]");
new giveidtrval(params); // zmieniamy tablicę params na liczbę i przypisujemy ją do nowej zmiennej giveid
if(!IsPlayerConnected(giveid) || giveid==playerid)return SendClientMessage(playerid,0xFF0000AA,"Złe id");
TogglePlayerSpectating(playerid,1); //ustawiamy sobie spec mode
switch(GetPlayerState(giveid)) // sprawdzamy ststus wybranego gracz
{
case 2,3layerSpectateVehicle(playerid,GetPlayerVehicleID(giveid)); //jeśli kierowca lub pasażer
case 0,1,7,8,4layerSpectatePlayer(playerid,giveid); // jeśli chodzi
case 9:return SendClientMessage(playerid,0x00CC00AA,"Tego gracza nie można podglądać!"); //jeśli ma spec mode
}
SendClientMessage(playerid,0x00CC00AA,"Podglądasz gracza, by przestać użyc /specoff");
SetPVarInt(playerid,"podgladam",giveid); // zapisujemy do pvar'a kogo podglądamy
SetPVarInt(giveid,"podglada",playerid); // zapisujemy do pvar'a podglądanego nasze id
return 1;
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid,"podglada",-1);
SetPVarInt(playerid,"podgladam",-1);
return 1;
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid,"podglada")!=-1) // jeśli ktoś nas podgląda
{
TogglePlayerSpectating(GetPVarInt(playerid,"podglada"),0); //wyłączamy spec mode temu kto nas podgląda
SetCameraBehindPlayer(GetPVarInt(playerid,"podglada")); //ustawiamy mu kamerę na normalną
SetPVarInt(GetPVarInt(playerid,"podglada"),"podgladam",-1); // ustawiamy mu pvar na -1 czyli nikogo nie podgląda
}
else if(GetPVarInt(playerid,"podgladam")!=-1)SetPVarInt(GetPVarInt(playerid,"podgladam"),"podglada",-1); //jeśli to my podgladamy to ustawi //jeśli to my podgladamy to ustawiamy -1 temu kogo podglądaliśmy
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPVarInt(playerid,"podglada")!=-1) // jeśli ktos nas podgląda
{
switch(newstate) // sprawdzamy wartość newstate (nowy status) za pomocą switch
{
case 0,1,7,8: PlayerSpectatePlayer(GetPVarInt(playerid,"podglada"),playerid); // jeśli nowy status to po za pojazdem to podglądający podgląda bezpośrednio nas
case 2,3:PlayerSpectateVehicle(GetPVarInt(playerid,"podglada"),GetPlayerVehicleID(playerid)); // jeśli nowy status to w pojeździe to podglądający nas podgląda nasz pojazd
case 9: // jeśli nasz nowy status to spec mode
{
SetPVarInt(GetPVarInt(playerid,"podglada"),"podgladam",-1); // ustawiamy pvar na -1 czyli że na już nie pogląda
TogglePlayerSpectating(GetPVarInt(playerid,"podglada"),0); // wyłączamy mu spec mode
SetCameraBehindPlayer(GetPVarInt(playerid,"podglada")); // i ustawiamy mu kamerę na normalną
}
}
}
return 1;
}
dcmd_specoff(playerid, params[])
{
#pragma unused params
TogglePlayerSpectating(playerid,0);
SetCameraBehindPlayer(playerid);
if(GetPVarInt(playerid,"podgladam")!=-1)SetPVarInt(GetPVarInt(playerid,"podgladam"),"podglada",-1);
SetPVarInt(playerid,"podgladam",-1);
return 1;
}Vad
Revise this Paste
Parent: 20631