06.01.2013, 16:19
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.
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;
}
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;
}
if(strcmp(cmd, "/spec", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5){ // <<< Isso aki й a variavel do Admin
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "(ERRO) Digite: /spec [id]");
return 1;
}
specplayerid = strval(tmp);
if(!IsPlayerConnected(specplayerid)) {
SendClientMessage(playerid, Vermelho, "(ERRO) ID Invбlido.");
return 1;
}
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, specplayerid);
SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
gSpectateID[playerid] = specplayerid;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER;
return 1;
}
}
if(strcmp(cmd, "/pararspec", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5){ // << Variavel do admin
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
return 1;
}
}
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
|
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;
}
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;
}
pawn Код:
|