[Ajuda][ERRO]public OnPlayerRequestClass...
#1

Olб pessoal!
Estou tentando adapta um sistema de "Moving camera on class selection" em meu humilde gm. porem esta dando alguns erros. acompanhe o codigo abaixo:
Topo do gm
pawn Код:
//where the player will spawn
#define player_x -250.9738
#define player_y 2585.6497
#define player_z 63.5703
#define player_angle 210.3500

//PLAYER CAMERA, THE ONE YOU CREATE SO YOU CAN SEE THE PLAYER
//note: for a better effect, let the camera be a few meters away from the player
#define camera_x -248.9410
#define camera_y 2581.5327
#define camera_z 64.9334

//ATTENTION; THESE ARE MILISECONDS
//untested, but it should work in theory. The smaller the value, the faster the camera.
#define moving_speed 50

//declaring stuff
//IMPORTANT: FOR THE CODE TO WORK, YOU MUST DEFINE THE ENUM BEFORE PlayerInfo
//just copy it like It's written here
enum pInfo
{
    bool:SpawnDance,
    Float:SpawnAngle,
    SpawnTimer
};

new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, player_x,player_y,player_z);
    SetPlayerFacingAngle(playerid, player_angle);
    SetPlayerCameraPos(playerid, camera_x,camera_y,camera_z);
    SetPlayerCameraLookAt(playerid, player_x,player_y,player_z);
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //smooth dancing. It's most fitting to the music
    PlayerPlaySound(playerid, 1097,-119.9460,23.1096,12.2238); //music, duh
    //making sure the timer gets executed only once, so the camera doesn't go to fast
    if (PlayerInfo[playerid][SpawnDance]) PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
    PlayerInfo[playerid][SpawnDance] = false; //preventing the timer to execute again
    return 1;
}
pawn Код:
//something I found in vactions.pwn
PreloadAnimLib(playerid, animlib[]) ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);

public OnPlayerConnect(playerid)
{   //loading the animation libraries
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"PED");
    //so the timer can be executed again
    PlayerInfo[playerid][SpawnDance] = true;
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //preventing a bug for the animation not being applied the first time OnPlayerRequestClass is called
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
  PlayerInfo[playerid][SpawnAngle] = 0.0; //so when you leave and another player comes, the camera will start from start
  PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
    SetCameraBehindPlayer(playerid); //to prevent some bugs
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  KillTimer( PlayerInfo[playerid][SpawnTimer] );
  return 1;
}
pawn Код:
//The business part of the code
forward MoveCamera(playerid);
public MoveCamera(playerid)
{
    //this is called trigonometry. It makes the camera spin
    //you can experiment with this line. Just change the values 2, 10 and 3 to make different effects
  SetPlayerCameraPos(playerid, player_x - 2 * floatsin(-PlayerInfo[playerid][SpawnAngle], degrees), player_y - 10 * floatcos(-PlayerInfo[playerid][SpawnAngle], degrees), player_z + 3);
  SetPlayerCameraLookAt(playerid, player_x, player_y, player_z + 0.5);
 
    //changing the angle a little
  PlayerInfo[playerid][SpawnAngle] += 0.5;

  if (PlayerInfo[playerid][SpawnAngle] >= 360.0)
    PlayerInfo[playerid][SpawnAngle] = 0.0;

}
Agora vamos aos erros.
pawn Код:
F:\Adriano-Panwo\gamemodes.pwn(167) : warning 201: redefinition of constant/macro (symbol "pInfo") //ja existe um outro "pInfo" em meu gm o que fazer ?.
F:\Adriano-Panwo\gamemodes.pwn(837) : warning 225: unreachable code
F:\Adriano-Panwo\gamemodes.pwn(1423) : error 021: symbol already defined: "ShowPlayerDialog"
F:\Adriano-Panwo\gamemodes.pwn(1426) : error 021: symbol already defined: "dini_IntSet"
F:\Adriano-Panwo\gamemodes.pwn(1428) : error 010: invalid function or declaration
F:\Adriano-Panwo\gamemodes.pwn(1430) : error 021: symbol already defined: "GivePlayerWeapon"
F:\Adriano-Panwo\gamemodes.pwn(1441) : error 021: symbol already defined: "TextDrawShowForPlayer"
F:\Adriano-Panwo\gamemodes.pwn(1442) : error 010: invalid function or declaration
F:\Adriano-Panwo\gamemodes.pwn(1444) : error 054: unmatched closing brace ("}")
F:\Adriano-Panwo\gamemodes.pwn(1445) : error 010: invalid function or declaration
F:\Adriano-Panwo\gamemodes.pwn(1452) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.
pawn Код:
//Dialogs
#define REGISTRO    1
#define LOGIN       2
#define AVISO       3

//REGISTRO
#define PASTA_CONTAS        "/Contas/%s.ini"         //Diretуrio onde as contas sгo salvas
#define MAX_SENHA           16                      //Tamanho mбximo da senha
#define MIN_SENHA           4                       //Tamanho mнnimo da senha
#define TENTATIVAS_LOGIN    3                       //Ao exceder o limite de tentativas, й kickado

enum pInfo
{
    Senha[MAX_SENHA+1],
    Logged,
    LoginsFalsos
} //linha 167!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

new PlayerInfo[MAX_PLAYERS][pInfo];
new file[128];
new STRX[256];
pawn Код:
TextDrawShowForPlayer(playerid, topblack);//linha 837
    TextDrawShowForPlayer(playerid, bottomblack);[/pwn]
[/pwna]  ShowPlayerDialog(playerid,DIALOG_CANAL,DIALOG_STYLE_LIST,"Mudar Canal","Canal 0\r\nCanal 1\r\nCanal 2\r\nCanal 3\r\nCanal 4\r\nCanal 5","Mudar", "Fechar");//linha 23
    TextDrawHideForPlayer(playerid, topblack);
    TextDrawHideForPlayer(playerid, bottomblack);
    dini_IntSet(file, "Skin", SkinSalvo[playerid]);//linha 1426
    SetPlayerSkin(playerid, SkinSalvo[playerid]);
    if(NoMataMata[playerid] == 1){//linha 1428
        RSpawnMataMata(playerid);
        GivePlayerWeapon(playerid,24,5000);//linha 1430
pawn Код:
TextDrawShowForPlayer(playerid, BKs); //linha 1441
    if(NoMataMata[playerid] == 0){ //linha 1442
    RandomSpawn(playerid);
    } //linha 1444
    if(DMer[playerid] == 1){ //linha 1445
        GivePlayerWeapon(playerid,24,5000);
        GivePlayerWeapon(playerid,27,5000);
        GivePlayerWeapon(playerid,29,5000);
        GivePlayerWeapon(playerid,31,5000);
        GivePlayerWeapon(playerid,34,5000);
    }
    return 1; //linha 1452
}

Creio eu que o poblema esta la em cima. me ajuda ?
quem quiser me ajuda e nao enteder muito bem o que eu to querendo baixa o gm "perfect games" e tenta coloca iso pra min. obrigado pessoal
Reply
#2

pawn Код:
public RandomSpawn(playerid)
{
    new rand = random(sizeof(LocaisSpawn));
    SetPlayerPos(playerid, LocaisSpawn[rand][0], LocaisSpawn[rand][1], LocaisSpawn[rand][2]); // Warp the player
    return 1;
}
ja existe
pawn Код:
new DMer[MAX_PLAYERS];
Reply
#3

Primeiro Tente Definir :
pawn Код:
#include <dini>
Depois Tente Trocar Akilo Por Isso :

pawn Код:
enum pInfo
{
    Senha[MAX_SENHA+1],
    Logged,
    LoginsFalsos
};
Agora Vamos Aqui
pawn Код:
TextDrawShowForPlayer(playerid, topblack);//linha 837
    TextDrawShowForPlayer(playerid, bottomblack);
ShowPlayerDialog(playerid,DIALOG_CANAL,DIALOG_STYLE_LIST,"Mudar Canal","Canal 0\r\nCanal 1\r\nCanal 2\r\nCanal 3\r\nCanal 4\r\nCanal 5","Mudar", "Fechar");//linha 23
    TextDrawHideForPlayer(playerid, topblack);
    TextDrawHideForPlayer(playerid, bottomblack);
    dini_IntSet("skins.ini",PlayerName(playerid),GetPlayerSkin(playerid));
    SetPlayerSkin(playerid, SkinSalvo[playerid]);
    if(NoMataMata[playerid] == 1){//linha 1428
    RSpawnMataMata(playerid);
pawn Код:
new NoMataMata[MAX_PLAYERS];
new DMer[MAX_PLAYERS];
pawn Код:
if(DMer[playerid] == 1){
            GivePlayerWeapon(playerid,24,5000);
            GivePlayerWeapon(playerid,27,5000);
            GivePlayerWeapon(playerid,29,5000);
            GivePlayerWeapon(playerid,31,5000);
            GivePlayerWeapon(playerid,34,5000);
            return 1;
 }
Tente Isso se der mais erro apaga. se der menos posta ai. =) pq nao deu pra entender nada oq tu postou tu nem explicou direito
Reply
#4

....
Reply
#5

Adriano Se Esse For Seu GM. Consegui Tirar Uns Erros em 10 segundos.

Click Aqui
Reply
#6

ei o gm nao tinha erro nao.. e voce nao add o codigo pra min man D:
da uma olhadinha ai pra min ve se consegue add
"o gm e da net mais e muito parecido com o meu"
Reply
#7

й tu quer adicionar ele. pensava que ja tinha pqp. vo ver aki

Lembrando : Esse GM Ta Cheio de Includes definidas que nao presta.
Reply
#8

desculpe o flood. mais nao da pra entender nada cara
Reply
#9

eu quero adicionar o "Moving camera on class selection" que esta em cima do topico. Nesse gm que eu te passei.. pra nao dificulta muito sua vida eu nao mechi no gm.. pra fica mais facil de voce me ajudar
Reply
#10

Vocк pegou daqui nй ?

Entaum vamp faz direito veio pqp vamo la.
Topo :
pawn Код:
//where the player will spawn
#define player_x -250.9738
#define player_y 2585.6497
#define player_z 63.5703
#define player_angle 210.3500

//PLAYER CAMERA, THE ONE YOU CREATE SO YOU CAN SEE THE PLAYER
//note: for a better effect, let the camera be a few meters away from the player
#define camera_x -248.9410
#define camera_y 2581.5327
#define camera_z 64.9334

//ATTENTION; THESE ARE MILISECONDS
//untested, but it should work in theory. The smaller the value, the faster the camera.
#define moving_speed 50

//declaring stuff
//IMPORTANT: FOR THE CODE TO WORK, YOU MUST DEFINE THE ENUM BEFORE PlayerInfo
//just copy it like It's written here
enum pInfo
{
    bool:SpawnDance,
    Float:SpawnAngle,
    SpawnTimer
};

new PlayerInfo[MAX_PLAYERS][pInfo];
PreloadAnimLib(playerid, animlib[]) ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
Agora DEFINA ISSO NO SEU GM QUE NгO TEM :
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, player_x,player_y,player_z);
    SetPlayerFacingAngle(playerid, player_angle);
    SetPlayerCameraPos(playerid, camera_x,camera_y,camera_z);
    SetPlayerCameraLookAt(playerid, player_x,player_y,player_z);
    ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //smooth dancing. It's most fitting to the music
    PlayerPlaySound(playerid, 1097,-119.9460,23.1096,12.2238); //music, duh
    //making sure the timer gets executed only once, so the camera doesn't go to fast
    if (PlayerInfo[playerid][SpawnDance]) PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
    PlayerInfo[playerid][SpawnDance] = false; //preventing the timer to execute again
    return 1;
}
OnPlayerSpawn:
pawn Код:
PlayerInfo[playerid][SpawnAngle] = 0.0; //so when you leave and another player comes, the camera will start from start
PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
SetCameraBehindPlayer(playerid); //to prevent some bugs
OnPlayerDisconnect :
pawn Код:
KillTimer( PlayerInfo[playerid][SpawnTimer] );
Final :
pawn Код:
forward MoveCamera(playerid);
public MoveCamera(playerid)
{
    //this is called trigonometry. It makes the camera spin
    //you can experiment with this line. Just change the values 2, 10 and 3 to make different effects
  SetPlayerCameraPos(playerid, player_x - 2 * floatsin(-PlayerInfo[playerid][SpawnAngle], degrees), player_y - 10 * floatcos(-PlayerInfo[playerid][SpawnAngle], degrees), player_z + 3);
  SetPlayerCameraLookAt(playerid, player_x, player_y, player_z + 0.5);
 
    //changing the angle a little
  PlayerInfo[playerid][SpawnAngle] += 0.5;

  if (PlayerInfo[playerid][SpawnAngle] >= 360.0)
    PlayerInfo[playerid][SpawnAngle] = 0.0;

}
Sу isso mano. da proxima ver c explica melhor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)