Help needed... having some errors.
#1

hi guys,
pawn tells me that gPlayerClass does not exist,
This is my code
Код:
public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(282,2291.6357,2457.0024,-7.1953,264.7728,3,0,24,250,29,900); // copspawn.
	AddPlayerClass(125,1461.5093,2773.4844,10.8203,266.7849,5,0,22,500,31,900); // maffia spawn place.
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  gPlayerClass[playerid] = classid;

  switch (classid) {

	   case 0: //Case 0 the character before the first one.

	    {
      gTeam[playerid] = TEAM_COPS;            //This checks of what team is the character of before. In this case the first character is the POLICE.
	       GameTextForPlayer(playerid, "~g~Cops", 1000, 6);  //This is the text that appears. "~g~" is the color (Green).

	    }
	   case 1: //Case 1 the character we added before the second.

	    {
      gTeam[playerid] = TEAM_MAFFIA;
      GameTextForPlayer(playerid, "~r~Maffia", 1000, 6);   // "~r~" (Red)
	    }
  }
  //Spawn positions the players will see to spawn.
  SetPlayerPos(playerid, 489.8416,-72.4437,999.2266);
  SetPlayerFacingAngle( playerid, 2.3616 );
  SetPlayerCameraPos(playerid, 491.6849,-72.3607,999.2117);
  SetPlayerCameraLookAt(playerid, 489.8416,-72.4437,999.2266);
  SetPlayerInterior(playerid ,11);
  return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
  if(gTeam[playerid] == TEAM_COPS)
  {
    SetPlayerColor(playerid, color);
  }
  if(gTeam[playerid] == TEAM_MAFFIA)
  {
	     SetPlayerColor(playerid, color);
  }

  
  new string[64], pName[MAX_PLAYER_NAME];
  if(gTeam[playerid] == gTeam[playerid])
  {
	     GetPlayerName(playerid,pNombre,MAX_PLAYER_NAME);
	     format(string,sizeof string,"%s has joined the battle.",pNombre); 
  }

public OnPlayerDeath(playerid, killerid, reason)
{
  SendDeathMessage(killerid, playerid, reason); 
  SetPlayerScore(killerid,(GetPlayerScore(killerid))+1); //This gives the killer 1 point of score.
  SetPlayerScore(playerid, -1); //This removes the dead player 1 point of score.

  
  new string[50];
  format(string, sizeof(string), "~w~You just got your ass kicked");
  GameTextForPlayer(playerid, string, 3000, 2);
  return 1;
I'm still learning pawn.. so I would be happy if you could help me.

(This is what PAWNO says)

C:\Users\Jorn\Desktop\TDMgame.pwn(53) : error 017: undefined symbol "gPlayerClass"
C:\Users\Jorn\Desktop\TDMgame.pwn(53) : warning 215: expression has no effect
C:\Users\Jorn\Desktop\TDMgame.pwn(53) : error 001: expected token: ";", but found "]"
C:\Users\Jorn\Desktop\TDMgame.pwn(53) : error 029: invalid expression, assumed zero
C:\Users\Jorn\Desktop\TDMgame.pwn(53) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Support would be nice:P.
Reply
#2

Because you never defined it. Place this code at the top of your script.

pawn Код:
new gPlayerclass[MAX_PLAYERS];
Reply
#3

Beat me to it
Reply
#4

Don't randomly copy paste code, anyway, you can just define it as a global variable by putting :
new gPlayerClass[MAX_PLAYERS];
after #include directives.

Edit : should've typed faster.
Reply
#5

Thanks for the quick answers guys,
I solved the problem (I forgot to define it (fail)),
I didnt post the whole code btw.. only a small piece.

EDIT: I edited it... still having the same prob.
Reply
#6

Post the whole code to pastebin, and the error(s) you get here.
Reply
#7

Alright,
here is my pastebin.

http://pastebin.com/aQcKkbKV
anyone able to fix it?
Reply
#8

Sorry for my absence, but simple thing, delete these places :
pawn Код:
#if defined FILTERSCRIPT
new gPlayerClass[MAX_PLAYERS];
pawn Код:
public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Blank Filterscript by your name here");
        print("--------------------------------------\n");
        return 1;
}
 
public OnFilterScriptExit()
{
        return 1;
}
 
#else
pawn Код:
#endif
I hope you can do that, for further information, look up ****** pre-processor tutorial in subforum.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)