[HELP] OnGameModeInit
#1

I try to add an "CreateObject" to my gamemode like this:
this is how i added it:

Код:
public OnGameModeInit()
{
// North LV Policedepartment - Made by Gr3gersen - Please leave credits.
CreateObject(13006, 1024.568481, 2432.473389, 9.840803, 0.0000, 0.0000, 181.7192);
CreateObject(12929, 1057.457520, 2411.245117, 9.818325, 0.0000, 0.0000, 90.0000);
CreateObject(12929, 1070.499390, 2411.191895, 9.818325, 0.0000, 0.0000, 90.0000);
CreateObject(1215, 1013.374634, 2401.241455, 10.470695, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1001.763000, 2401.271484, 10.522131, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1074.783325, 2403.154785, 10.384636, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1097.315552, 2403.294434, 10.384637, 0.0000, 0.0000, 0.0000);
CreateObject(2690, 1072.835815, 2403.395752, 11.637175, 0.0000, 0.0000, 180.0000);
CreateObject(2690, 1055.228149, 2403.448975, 11.701709, 0.0000, 0.0000, 180.0000);
CreateObject(1650, 1074.998535, 2418.843262, 10.126975, 0.0000, 0.0000, 112.5000);
CreateObject(994, 1079.388184, 2403.144287, 9.920630, 0.0000, 0.0000, 0.0000);
CreateObject(994, 1090.677490, 2403.291260, 9.920630, 0.0000, 0.0000, 0.0000);
CreateObject(994, 1013.243225, 2407.574219, 9.948933, 0.0000, 0.0000, 271.7189);
CreateObject(1233, 1014.432617, 2436.842041, 11.381072, 0.0000, 0.0000, 270.0000);
	SetGameModeText("[TC]Official");
	SetWorldTime(7);
And These Are The Warnings: NOTE: IT DOES COMPILE, BUT THE OBJECTS DONT APPEAR IN GAME!!!

Код:
C:\DOCUME~1\ADMIN~1.GEO\Desktop\PRESID~2\GAMEMO~1\PTPM.pwn(88) : warning 217: loose indentation
C:\DOCUME~1\ADMIN~1.GEO\Desktop\PRESID~2\GAMEMO~1\PTPM.pwn(453) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
C:\DOCUME~1\ADMIN~1.GEO\Desktop\PRESID~2\GAMEMO~1\PTPM.pwn(475) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Here is the script from line 71 to 475!PLEASE HELP:

Код:
public OnGameModeInit()
{
// North LV Policedepartment - Made by Gr3gersen - Please leave credits.
CreateObject(13006, 1024.568481, 2432.473389, 9.840803, 0.0000, 0.0000, 181.7192);
CreateObject(12929, 1057.457520, 2411.245117, 9.818325, 0.0000, 0.0000, 90.0000);
CreateObject(12929, 1070.499390, 2411.191895, 9.818325, 0.0000, 0.0000, 90.0000);
CreateObject(1215, 1013.374634, 2401.241455, 10.470695, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1001.763000, 2401.271484, 10.522131, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1074.783325, 2403.154785, 10.384636, 0.0000, 0.0000, 0.0000);
CreateObject(1215, 1097.315552, 2403.294434, 10.384637, 0.0000, 0.0000, 0.0000);
CreateObject(2690, 1072.835815, 2403.395752, 11.637175, 0.0000, 0.0000, 180.0000);
CreateObject(2690, 1055.228149, 2403.448975, 11.701709, 0.0000, 0.0000, 180.0000);
CreateObject(1650, 1074.998535, 2418.843262, 10.126975, 0.0000, 0.0000, 112.5000);
CreateObject(994, 1079.388184, 2403.144287, 9.920630, 0.0000, 0.0000, 0.0000);
CreateObject(994, 1090.677490, 2403.291260, 9.920630, 0.0000, 0.0000, 0.0000);
CreateObject(994, 1013.243225, 2407.574219, 9.948933, 0.0000, 0.0000, 271.7189);
CreateObject(1233, 1014.432617, 2436.842041, 11.381072, 0.0000, 0.0000, 270.0000);
	SetGameModeText("[TC]Official");
	SetWorldTime(7);
	//SKINS:
	
	//BodyGuards:
	AddPlayerClass(163, 2159.8850,1711.8789,11.0469,325.9562,0,0,0,0,0,0);
	AddPlayerClass(164, 2159.8850,1711.8789,11.0469,325.9562,0,0,0,0,0,0);
	AddPlayerClass(165, 2159.8850,1711.8789,11.0469,325.9562,0,0,0,0,0,0);
	AddPlayerClass(166, 2159.8850,1711.8789,11.0469,325.9562,0,0,0,0,0,0);
	
	//Terrorists:
	AddPlayerClass(121, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	AddPlayerClass(122, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	AddPlayerClass(181, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	AddPlayerClass(194, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	AddPlayerClass(195, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	AddPlayerClass(192, 425.7920,2532.6323,16.5880,180.9430,0,0,0,0,0,0);
	
	//President:
	AddPlayerClass(147, 2177.8733,1682.3524,10.8203,90.5182,0,0,0,0,0,0);
	
	//Vice President:
	AddPlayerClass(165, 2177.8733,1682.3524,10.8203,90.5182,0,0,0,0,0,0);

	//C.I.A.:
	AddPlayerClass(285, 940.9542,1733.1642,8.8516,273.3067,0,0,0,0,0,0);
	
	//Police:
  AddPlayerClass(280, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
  AddPlayerClass(281, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
  AddPlayerClass(282, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
  AddPlayerClass(283, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
  AddPlayerClass(284, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
  AddPlayerClass(288, 2293.1609,2468.7917,10.8203,91.1740,0,0,0,0,0,0);
	
	//ARMY:
	AddPlayerClass(287, 213.3638,1877.3098,13.1406,1.0887,0,0,0,0,0,0);
	
	//FIRE:
	AddPlayerClass(277, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	AddPlayerClass(278, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	AddPlayerClass(279, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	
	//MEDIC:
	AddPlayerClass(274, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	AddPlayerClass(275, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	AddPlayerClass(276, 1607.5551,1815.8722,10.8203,1.8558,0,0,0,0,0,0);
	
	//TOURIST:
	AddPlayerClass(26, -670.6626,3125.1699,4.6880,2.2661,0,0,0,0,0,0);
	AddPlayerClass(23, -670.6626,3125.1699,4.6880,2.2661,0,0,0,0,0,0);
	
	//Vehicle and object for ClassSelection-Screen:
	AddStaticVehicle(484, 4498.3254,-2517.7302,-0.4128,138.2467, -1, -1);
	CreateObject(12990, 4495.664063, -2510.759155, 2.373306, 0.0000, 0.0000, 270.0000);

	//Pickups
	AddStaticPickup(1242,2,2165.77,1707.72,11.05); //ARMOUR AT PRESIDENT BASE
	AddStaticPickup(1240,2,2163.86,1707.41,11.04); //HEALTH AT PRESIDENT BASE
	AddStaticPickup(1242,2,433.74,2523.00,16.48); //ARMOUR AT TERRORIST BASE
	AddStaticPickup(1240,2,433.52,2526.43,16.55); //HEALTH AT TERRORIST BASE

	//Load other Vehicles:
	LoadVehicles();

	if(!dini_Exists("Protect The PM/Scores.txt"))
	{
	  dini_Create("Protect The PM/Scores.txt");
	  dini_IntSet("Protect The PM/Scores.txt", "PMSCORE", 0);
	  dini_IntSet("Protect The PM/Scores.txt", "TERRORISTSCORE", 0);
	}
	PMscore = dini_Int("Protect The PM/Scores.txt", "PMSCORE");
	TerroristScore = dini_Int("Protect The PM/Scores.txt", "TERRORISTSCORE");
	format(TextdrawString, 128, " ");
	Textdraw = TextDrawCreate(480, 420, TextdrawString);
	TextDrawLetterSize(Textdraw,0.40,1.10);
	TextDrawSetShadow(Textdraw, 0);
	TextDrawSetOutline(Textdraw, 1);
	
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerWeather(playerid, 1);
	SetPlayerPos(playerid, 2939.0447,-2051.4888,3.5480);
  SetPlayerCameraPos(playerid, 2934.0447,-2051.4886,4.5480);
  SetPlayerCameraLookAt(playerid, 2939.0447,-2051.4888,3.5480);
  PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
  SetPlayerFacingAngle(playerid, 91.9195);
	switch(classid)
	{
		case 0..3:
		{
		  GameTextForPlayer(playerid, "~b~Bodyguard", 999999, 6);
		  gTeam[playerid] = BODYGUARD;
		}
		case 4..9:
		{
		  GameTextForPlayer(playerid, "~r~Terrorist", 999999, 6);
		  gTeam[playerid] = TERRORIST;
		}
		case 10:
		{
		  GameTextForPlayer(playerid, "~y~President", 999999, 6);
		  if(IsPMChosen == 1)
		  {
		    GameTextForPlayer(playerid, "~y~President~n~~r~Not Available", 999999, 6);
			}
		  gTeam[playerid] = PM;
		}
		case 11:
		{
		  GameTextForPlayer(playerid, "~y~Vice-President", 999999, 6);
		  if(IsVPMChosen == 1)
		  {
		    GameTextForPlayer(playerid, "~y~Vice-President~n~~r~Not Available", 999999, 6);
			}
		  gTeam[playerid] = VPM;
		}
		case 12:
		{
		  GameTextForPlayer(playerid, "~b~C.I.A.", 999999, 6);
		  gTeam[playerid] = CIA;
		}
		case 13..18:
		{
		  GameTextForPlayer(playerid, "~b~Police", 999999, 6);
		  gTeam[playerid] = POLICE;
		}
		case 19:
		{
		  GameTextForPlayer(playerid, "~r~Army", 999999, 6);
		  gTeam[playerid] = ARMY;
		}
		case 20..22:
		{
		  GameTextForPlayer(playerid, "~r~FireMan", 999999, 6);
		  gTeam[playerid] = FIRE;
		}
		case 23..25:
		{
		  GameTextForPlayer(playerid, "~r~Medic", 999999, 6);
		  gTeam[playerid] = MEDIC;
		}
		case 26..27:
		{
		  GameTextForPlayer(playerid, "~r~Tourist", 999999, 6);
		  gTeam[playerid] = MEDIC;
		}
	}
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	new pName[MAX_PLAYER_NAME], str[128];
	GetPlayerName(playerid, pName, sizeof(pName));
	
	if(IsPMChosen == 1 && gTeam[playerid] == PM)
	{
		return 0;
	}
	else if(IsPMChosen == 0 && gTeam[playerid] == PM)
	{
	  IsPMChosen = 1;
	}
	format(str, sizeof(str), "%s is now a %s!", pName, TeamNames[gTeam[playerid]]);
	SendClientMessageToAll(0xFFFFFFAA, str);
	return 1;
}

public OnPlayerConnect(playerid)
{
  new pName[MAX_PLAYER_NAME], str[128];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(str, sizeof(str), "%s has joined the server!", pName);
  SendClientMessageToAll(0x33AA33AA, str);
  SendDeathMessage(playerid, playerid, 200);
  gTeam[playerid] = TEAMLESS;
  Muted[playerid] = 0;
  SetPlayerColor(playerid, TEAMCOLOR_TEAMLESS);
  GivePlayerMoney(playerid, StartMoney);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  new pName[MAX_PLAYER_NAME], str[128];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(str, sizeof(str), "%s has left the server!", pName);
  SendClientMessageToAll(0xA9A9A9AA, str);
  SendDeathMessage(playerid, playerid, 201);
  if(gTeam[playerid] == PM)
	{
	  format(str, sizeof(str), "%s is no longer the President", pName);
	  SendClientMessageToAll(0xFFA500AA, str);
	  TextDrawHideForAll(Textdraw);
	  IsPMChosen = 0;
	  KillTimer(RoundTimer);
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
	GameTextForPlayer(playerid, "Type /help For Commands", 10, 3);
	PlayerPlaySound(playerid, 1063, 0.0, 0.0, 0.0);
  SetPlayerWeather(playerid, 1);
  if(playerid == IsDeadPM)
  {
    TogglePlayerControllable(playerid, 0);
	}
  switch(gTeam[playerid])
  {
    case BODYGUARD:
    {
      SetPlayerPos(playerid, 2159.8850,1711.8789,11.0469);
      SetPlayerFacingAngle(playerid, random(360));
      SetPlayerColor(playerid, TEAMCOLOR_BODYGUARD);
    }
    case TERRORIST:
    {
      SetPlayerPos(playerid, 425.7920,2532.6323,16.5880);
      SetPlayerFacingAngle(playerid, random(360));
      SetPlayerColor(playerid, TEAMCOLOR_TERRORIST);
		}
    case PM:
    {
      SetPlayerPos(playerid, 2177.8733,1682.3524,10.8203);
      SetPlayerFacingAngle(playerid, 45.857);
      SetPlayerColor(playerid, TEAMCOLOR_PM);
      if(playerid != IsDeadPM)
			{
	      RoundTimer = SetTimer("EndRound", 1000, 1);
	      TimeLeft = RoundTime*60;
			}
    }
    case POLICE:
    {
      SetPlayerPos(playerid, 2293.1609,2468.7917,10.8203);
      SetPlayerFacingAngle(playerid, random(360));
      SetPlayerColor(playerid, TEAMCOLOR_POLICE);
		}
	}
  
  SetCameraBehindPlayer(playerid);
  
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	SendDeathMessage(killerid, playerid, reason);
	SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
	if(killerid != INVALID_PLAYER_ID)
	{
	  SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
	}
	if(gTeam[playerid] == PM)
	{
		//The Prime Minister Died!
		IsDeadPM = playerid;
		IsPMChosen = 0;
		KillTimer(RoundTimer);
		TerroristScore++;
		new str[128];
		format(str, 128, "The President Has Been Assassinated!", RoundTime);
		SendClientMessageToAll(0xFFFF00AA, " ");
		SendClientMessageToAll(0xFFFF00AA, " ");
		SendClientMessageToAll(0xFFFF00AA, str);
		SendClientMessageToAll(0xFFFF00AA, " ");
		SendClientMessageToAll(0xFFFF00AA, "A new round will start soon! Please Wait PRESIDENT: /gate1 and /gate2 TO OPEN GATES AT BASE!");
		SendClientMessageToAll(0xFFFF00AA, " ");
	  SendClientMessageToAll(0xFFFF00AA, "Scores:");
	  format(str, 128, "-- President/Bodyguards & Police: %d", PMscore);
	  SendClientMessageToAll(0xFFFF00AA, str);
	  format(str, 128, "-- Terrorists & Psycho's: %d", TerroristScore);
	  SendClientMessageToAll(0xFFFF00AA, str);
	  SendClientMessageToAll(0xFFFF00AA, " ");
	  TextDrawHideForAll(Textdraw);
		for(new i; i<MAX_PLAYERS; i++)
		{
		  if(IsPlayerConnected(i))
		  {
		    PlayerPlaySound(i, 1185, 0.0, 0.0, 0.0);
		    if(gTeam[i] == TERRORIST || gTeam[i] == PSYCHO)
		    {
		      GameTextForPlayer(i, "~y~Congratulations Mr.President!", 8000, 3);
				}
				if(gTeam[i] == PM || gTeam[i] == BODYGUARD || gTeam[i] == POLICE)
		    {
		      GameTextForPlayer(i, "~r~Starting New Round", 8000, 3);
				}
			}
		}
		SetTimer("StartNewGame", 8000, 0);
		TogglePlayerControllable(playerid, 0);
	  
	}
	return 1;
}

public OnPlayerText(playerid, text[])
{
  if(Muted[playerid] == 1)
	{
		SendClientMessage(playerid, 0xFF0000AA, "You're muted!");
		return 0;
	}
	if(text[0] == '#')
	{
	  //TeamChat
		new str[128], pn[24];
		GetPlayerName(playerid, pn, 24);
		format(str, 128, "[TEAM]%s: %s", pn, text[1]);
		if(gTeam[playerid] == PM || gTeam[playerid] == BODYGUARD || gTeam[playerid] == POLICE)
		{
			for(new i; i<MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
				  if(gTeam[i] == PM || gTeam[i] == BODYGUARD || gTeam[i] == POLICE)
					{
					  SendClientMessage(i, 0xFFFF00AA, str);
  				}
				}
			}
		}
		if(gTeam[playerid] == TERRORIST)
		{
		  for(new i; i<MAX_PLAYERS; i++)
			{
			  if(IsPlayerConnected(i))
				{
				  if(gTeam[i] == TERRORIST)
					{
					  SendClientMessage(i, 0xFFFF00AA, str);
					}
				}
			}
		}
		if(gTeam[playerid] == PSYCHO)
		{
		  for(new i; i<MAX_PLAYERS; i++)
			{
			  if(IsPlayerConnected(i))
				{
				  if(gTeam[i] == PSYCHO)
					{
					  SendClientMessage(i, 0xFFFF00AA, str);
					}
				}
			}
		}
		return 0;
	}
	return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
	if(Muted[playerid] == 1)
	{
		SendClientMessage(playerid, 0xFF0000AA, "You're muted!");
		return 0;
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext[1],"pm",true,2))
{
if(!cmdtext[3]||!cmdtext[4])return SendClientMessage(playerid,0xF8DA07FF,"USAGE: /pm [playerid] [text]");
new receiverid = strval(cmdtext[4]);
if(!IsPlayerConnected(receiverid))return SendClientMessage(playerid,0xF8DA07FF,"Invalid Player ID!");
new begintext = strfind(cmdtext[4]," ")+1;
if(!strlen(cmdtext[begintext]))return SendClientMessage(playerid,0xF8DA07FF,"USAGE: /pm [playerid] [text]");
OnPlayerPrivmsg(playerid, receiverid, cmdtext[begintext]);
return 1;
}
  if(strcmp("/help", cmdtext, true) == 0)
Reply
#2

loose indentation means your missing something probably a PC-Made Space before each CreateObject press TAB so it has a space between it, like the SetGameModeText
Reply
#3

i just did that. now it compiles succesful, but still doesnt appear in game
Reply
#4

Quote:
Originally Posted by ♣ ©ⓤⓝⓔⓞ ♣
loose indentation means your missing something probably a PC-Made Space before each CreateObject press TAB so it has a space between it, like the SetGameModeText
OMG OMG!!! that WAS the problem THANK YOU SOOOO MUCH! this has been bothering me forever!!!
Reply
#5

Alright well, glad i could help, you can add me on msn @ nyrpmike@live.co.uk if you have any other problems or just PM me on here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)