SA-MP Forums Archive
GAMEMODE PROBLEM ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GAMEMODE PROBLEM ! (/showthread.php?tid=152167)



GAMEMODE PROBLEM ! - samperzo - 02.06.2010

Can anybody tell what's wrong? Thanks!



// Dogg's Bodyguards vs. Vagos
// By Ernesto Team


#include <a_samp>
#include <a_npc>
#include <a_objects>
#include <a_players>
#include <a_vehicles>

main()
{
print("\n----------------------------------");
print(" Dogg's Bodyguards vs. Vagos by Ernesto Team");
print("----------------------------------\n");
}



public OnGameModeInit()
{
SetGameModeText("Dogg's Bodyguards vs. Vagos");
ShowPlayerMarkers (1);
ShowNameTags (1);

// Player Class's
AddPlayerClass(108,2010.7942,-977.7839,35.5584,205.6268,30,1000,28,1000,25,1000 );//
AddPlayerClass(109,2010.7942,-977.7839,35.5584,205.6268,31,1000,32,1000,27,1000 );//
AddPlayerClass(110, 2010.7942,-977.7839,35.5584,205.6268,29,1000,24,1000,26,1000) ;//
AddPlayerClass(24,1268.9780,-774.8776,95.9643,271.4181,31,1000,29,1000,25,1000) ; //
AddPlayerClass(25,1268.9780,-774.8776,95.9643,271.4181,30,1000,32,1000,27,1000) ; //

// Car Spawns

AddStaticVehicle(507,1241.5936,-784.1112,90.4138,356.9539,53,53); //
AddStaticVehicle(426,1241.5458,-800.8099,88.8707,346.9272,53,53); //
AddStaticVehicle(507,1247.9348,-770.7127,91.7121,349.1205,53,53); //
AddStaticVehicle(521,1247.6152,-760.5258,92.7888,2.2807,53,53); //
AddStaticVehicle(426,1246.3136,-749.7743,94.0978,9.1741,53,53); //
AddStaticVehicle(521,1255.8652,-734.9267,93.9641,293.6600,53,53); //
AddStaticVehicle(521,1262.3571,-742.7164,94.6220,295.8534,53,53); //
AddStaticVehicle(507,1268.7791,-739.6047,94.2963,295.8534,53,53); //
AddStaticVehicle(507,1251.6659,-725.3476,94.4226,118.5284,53,53); //
AddStaticVehicle(521,1241.7017,-730.7644,95.1776,118.5284,53,53); //
AddStaticVehicle(474,2033.4519,-978.9692,40.5321,294.6488,6,6); //
AddStaticVehicle(576,2026.3047,-979.0865,38.7263,94.2819,6,6); //
AddStaticVehicle(474,2027.6189,-982.8362,38.6760,274.2819,6,6); //
AddStaticVehicle(576,2033.2075,-981.9511,40.2619,274.2819,6,6); //
AddStaticVehicle(576,2040.0082,-980.6811,42.0850,274.2819,6,6); //
AddStaticVehicle(576,2042.0410,-983.7855,42.5080,184.2818,6,6); //
AddStaticVehicle(474,2037.5492,-984.3094,41.1936,94.2819,6,6); //
AddStaticVehicle(461,2028.5708,-982.3179,38.9964,274.2819,6,6); //
AddStaticVehicle(461,2026.2367,-984.3390,38.1118,274.2819,6,6); //
AddStaticVehicle(461,2023.1825,-979.8481,37.9125,274.2819,6,6); //
AddStaticVehicle(467,2019.2034,-984.3046,36.3059,274.2819,6,6); //
AddStaticVehicle(467,2020.0173,-989.8168,35.6436,274.2819,6,6); //

return 1;
}

#define TEAM_BODYGUARDS 1
#define TEAM_VAGOS 2


#define COLOR_BLUE 0x0000FFFF
#define COLOR_YELLOW 0xF0FF00FF



#define COLOR_BODYGUARDS 0x0000FFFF
#define COLOR_VAGOS 0xF0FF00FF



SetPlayerTeamFromClass(playerid, classid)
{
if (classid == 0)
{
gTeam[playerid] = TEAM_BODYGUARDS;
}
else
{
gTeam[playerid] = TEAM_VAGOS;
}
}



public OnGameModeExit()
{
return 1;
}



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

public OnPlayerSpawn(playerid)
{
new PlayerName[MAX_PLAYER_NAME],
string[128];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s has spawned.", PlayerName);
SendClientMessageToAll(0xFFFFFFFF, string);
}

public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}

public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~Dogg's Bodyguards vs Vagos",5000,5);
SendPlayerFormattedText(playerid, "Welcome to Dogg's Bodyguards vs Vagos,0);
gActivePlayers[playerid]++;
gLastGaveCash[playerid] = GetTickCount();
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new
string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);

if(classid == 1)
{
GameTextForPlayer(playerid,"~r~Defend crib from Vagos",5000,4);
gPlayerClass[playerid] = 1;
SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
SetPlayerInterior(playerid,0);
}
else if(classid == 2)
{
GameTextForPlayer(playerid,"~r~Attack Madd Dogg's crib",5000,4);
gPlayerClass[playerid] = 2;
SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
SetPlayerInterior(playerid,0);
}


Re: GAMEMODE PROBLEM ! - Infinity - 02.06.2010

errors would help too...


Re: GAMEMODE PROBLEM ! - azzerking - 02.06.2010

The Define Teams Should Go At Top Of Script


Re: GAMEMODE PROBLEM ! - IcyBlight - 02.06.2010

There are 2 OnPlayerConnect...


Re: GAMEMODE PROBLEM ! - xxjackoxx - 02.06.2010

Код:
// Dogg's Bodyguards vs. Vagos
// By Ernesto Team


#include <a_samp>
#include <a_npc>
#include <a_objects>
#include <a_players>
#include <a_vehicles>

#define TEAM_BODYGUARDS 1
#define TEAM_VAGOS 2
#define COLOR_BLUE 0x0000FFFF
#define COLOR_YELLOW 0xF0FF00FF
#define COLOR_BODYGUARDS 0x0000FFFF
#define COLOR_VAGOS 0xF0FF00FF

main()
{
  print("\n----------------------------------");
  print(" Dogg's Bodyguards vs. Vagos by Ernesto Team");
  print("----------------------------------\n");
}



public OnGameModeInit()
{
  SetGameModeText("Dogg's Bodyguards vs. Vagos");
  ShowPlayerMarkers (1);
  ShowNameTags (1);

  // Player Class's
  AddPlayerClass(108,2010.7942,-977.7839,35.5584,205.6268,30,1000,28,1000,25,1000 );//
  AddPlayerClass(109,2010.7942,-977.7839,35.5584,205.6268,31,1000,32,1000,27,1000 );//
  AddPlayerClass(110, 2010.7942,-977.7839,35.5584,205.6268,29,1000,24,1000,26,1000);//
  AddPlayerClass(24,1268.9780,-774.8776,95.9643,271.4181,31,1000,29,1000,25,1000); //
  AddPlayerClass(25,1268.9780,-774.8776,95.9643,271.4181,30,1000,32,1000,27,1000); //

  // Car Spawns
  
  AddStaticVehicle(507,1241.5936,-784.1112,90.4138,356.9539,53,53); //
  AddStaticVehicle(426,1241.5458,-800.8099,88.8707,346.9272,53,53); //
  AddStaticVehicle(507,1247.9348,-770.7127,91.7121,349.1205,53,53); //
  AddStaticVehicle(521,1247.6152,-760.5258,92.7888,2.2807,53,53); //
  AddStaticVehicle(426,1246.3136,-749.7743,94.0978,9.1741,53,53); //
  AddStaticVehicle(521,1255.8652,-734.9267,93.9641,293.6600,53,53); //
  AddStaticVehicle(521,1262.3571,-742.7164,94.6220,295.8534,53,53); //
  AddStaticVehicle(507,1268.7791,-739.6047,94.2963,295.8534,53,53); //
  AddStaticVehicle(507,1251.6659,-725.3476,94.4226,118.5284,53,53); //
  AddStaticVehicle(521,1241.7017,-730.7644,95.1776,118.5284,53,53); //
  AddStaticVehicle(474,2033.4519,-978.9692,40.5321,294.6488,6,6); //
  AddStaticVehicle(576,2026.3047,-979.0865,38.7263,94.2819,6,6); //
  AddStaticVehicle(474,2027.6189,-982.8362,38.6760,274.2819,6,6); //
  AddStaticVehicle(576,2033.2075,-981.9511,40.2619,274.2819,6,6); //
  AddStaticVehicle(576,2040.0082,-980.6811,42.0850,274.2819,6,6); //
  AddStaticVehicle(576,2042.0410,-983.7855,42.5080,184.2818,6,6); //
  AddStaticVehicle(474,2037.5492,-984.3094,41.1936,94.2819,6,6); //
  AddStaticVehicle(461,2028.5708,-982.3179,38.9964,274.2819,6,6); //
  AddStaticVehicle(461,2026.2367,-984.3390,38.1118,274.2819,6,6); //
  AddStaticVehicle(461,2023.1825,-979.8481,37.9125,274.2819,6,6); //
  AddStaticVehicle(467,2019.2034,-984.3046,36.3059,274.2819,6,6); //
  AddStaticVehicle(467,2020.0173,-989.8168,35.6436,274.2819,6,6); //

  return 1;
}





SetPlayerTeamFromClass(playerid, classid)
{
  if (classid == 0)
  {
   gTeam[playerid] = TEAM_BODYGUARDS;
  }
  else
  {
   gTeam[playerid] = TEAM_VAGOS;
  }
}



public OnGameModeExit()
{
  return 1;
}



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

public OnPlayerSpawn(playerid)
{
  new PlayerName[MAX_PLAYER_NAME],
  string[128];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(string, sizeof(string), "%s has spawned.", PlayerName);
  SendClientMessageToAll(0xFFFFFFFF, string);
}

public OnPlayerRequestClass(playerid, classid)
{
   SetupPlayerForClassSelection(playerid);
  return 1;
}

public SetupPlayerForClassSelection(playerid)
{
  SetPlayerInterior(playerid,0);
  SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  SetPlayerFacingAngle(playerid, 270.0);
  SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerConnect(playerid)
{
  GameTextForPlayer(playerid,"~w~Dogg's Bodyguards vs Vagos",5000,5);
  SendPlayerFormattedText(playerid, "Welcome to Dogg's Bodyguards vs Vagos,0);
  gActivePlayers[playerid]++;
  gLastGaveCash[playerid] = GetTickCount();
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  new
    string[64],
    name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  switch(reason)
  {
    case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
    case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
    case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
  }
  SendClientMessageToAll(0xFFFFFFAA,string);
  return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
  SetPlayerTeamFromClass(playerid, classid);
  
  if(classid == 1)
  {
   GameTextForPlayer(playerid,"~r~Defend crib from Vagos",5000,4);
   gPlayerClass[playerid] = 1;
   SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
   SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
   SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
   SetPlayerInterior(playerid,0);
  }
  else if(classid == 2)
  {
   GameTextForPlayer(playerid,"~r~Attack Madd Dogg's crib",5000,4);
   gPlayerClass[playerid] = 2;
   SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
   SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
   SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
   SetPlayerInterior(playerid,0);
  }



Re: GAMEMODE PROBLEM ! - sjvt - 02.06.2010

Quote:
Originally Posted by IcyBlight
There are 2 OnPlayerConnect...
Then he do copy and past xD next time use pawn code or upload it to pastebin


Re: GAMEMODE PROBLEM ! - aircombat - 02.06.2010

here is the whole script fixed and nothing deleted from it

Код:
// Dogg's Bodyguards vs. Vagos
// By Ernesto Team


#include <a_samp>
#include <a_npc>
#include <a_objects>
#include <a_players>
#include <a_vehicles>
#define TEAM_BODYGUARDS 1
#define TEAM_VAGOS 2
#define COLOR_BLUE 0x0000FFFF
#define COLOR_YELLOW 0xF0FF00FF
#define COLOR_BODYGUARDS 0x0000FFFF
#define COLOR_VAGOS 0xF0FF00FF
new gTeam[MAX_PLAYERS];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];
main()
{
  print("\n----------------------------------");
  print(" Dogg's Bodyguards vs. Vagos by Ernesto Team");
  print("----------------------------------\n");
}



public OnGameModeInit()
{
	SetGameModeText("Dogg's Bodyguards vs. Vagos");
	ShowPlayerMarkers (1);
	ShowNameTags (1);

  // Player Class's
	AddPlayerClass(108,2010.7942,-977.7839,35.5584,205.6268,30,1000,28,1000,25,1000 );//
	AddPlayerClass(109,2010.7942,-977.7839,35.5584,205.6268,31,1000,32,1000,27,1000 );//
	AddPlayerClass(110, 2010.7942,-977.7839,35.5584,205.6268,29,1000,24,1000,26,1000);//
	AddPlayerClass(24,1268.9780,-774.8776,95.9643,271.4181,31,1000,29,1000,25,1000); //
	AddPlayerClass(25,1268.9780,-774.8776,95.9643,271.4181,30,1000,32,1000,27,1000); //

  // Car Spawns

	AddStaticVehicle(507,1241.5936,-784.1112,90.4138,356.9539,53,53); //
  AddStaticVehicle(426,1241.5458,-800.8099,88.8707,346.9272,53,53); //
  AddStaticVehicle(507,1247.9348,-770.7127,91.7121,349.1205,53,53); //
  AddStaticVehicle(521,1247.6152,-760.5258,92.7888,2.2807,53,53); //
  AddStaticVehicle(426,1246.3136,-749.7743,94.0978,9.1741,53,53); //
  AddStaticVehicle(521,1255.8652,-734.9267,93.9641,293.6600,53,53); //
  AddStaticVehicle(521,1262.3571,-742.7164,94.6220,295.8534,53,53); //
  AddStaticVehicle(507,1268.7791,-739.6047,94.2963,295.8534,53,53); //
  AddStaticVehicle(507,1251.6659,-725.3476,94.4226,118.5284,53,53); //
  AddStaticVehicle(521,1241.7017,-730.7644,95.1776,118.5284,53,53); //
  AddStaticVehicle(474,2033.4519,-978.9692,40.5321,294.6488,6,6); //
  AddStaticVehicle(576,2026.3047,-979.0865,38.7263,94.2819,6,6); //
  AddStaticVehicle(474,2027.6189,-982.8362,38.6760,274.2819,6,6); //
  AddStaticVehicle(576,2033.2075,-981.9511,40.2619,274.2819,6,6); //
  AddStaticVehicle(576,2040.0082,-980.6811,42.0850,274.2819,6,6); //
  AddStaticVehicle(576,2042.0410,-983.7855,42.5080,184.2818,6,6); //
  AddStaticVehicle(474,2037.5492,-984.3094,41.1936,94.2819,6,6); //
  AddStaticVehicle(461,2028.5708,-982.3179,38.9964,274.2819,6,6); //
  AddStaticVehicle(461,2026.2367,-984.3390,38.1118,274.2819,6,6); //
  AddStaticVehicle(461,2023.1825,-979.8481,37.9125,274.2819,6,6); //
  AddStaticVehicle(467,2019.2034,-984.3046,36.3059,274.2819,6,6); //
  AddStaticVehicle(467,2020.0173,-989.8168,35.6436,274.2819,6,6); //

  return 1;
}


SetPlayerTeamFromClass(playerid, classid)
{
  if (classid == 0)
  {
   gTeam[playerid] = TEAM_BODYGUARDS;
  }
  else
  {
   gTeam[playerid] = TEAM_VAGOS;
  }
}



public OnGameModeExit()
{
  return 1;
}



public OnPlayerSpawn(playerid)
{
  new PlayerName[MAX_PLAYER_NAME],
  string[128];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  format(string, sizeof(string), "%s has spawned.", PlayerName);
  SendClientMessageToAll(0xFFFFFFFF, string);
}

forward SetupPlayerForClassSelection(playerid);
public SetupPlayerForClassSelection(playerid)
{
	SetPlayerInterior(playerid,0);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerConnect(playerid)
{
  GameTextForPlayer(playerid,"~w~Dogg's Bodyguards vs Vagos",5000,5);
  SendClientMessage(playerid,COLOR_YELLOW, "Welcome to Dogg's Bodyguards vs Vagos");
  gActivePlayers[playerid]++;
  gLastGaveCash[playerid] = GetTickCount();
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  new
    string[64],
    name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  switch(reason)
  {
    case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
    case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
    case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
  }
  SendClientMessageToAll(0xFFFFFFAA,string);
  return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
	  SetPlayerTeamFromClass(playerid, classid);

	  if(classid == 1)
	  {
	   GameTextForPlayer(playerid,"~r~Defend crib from Vagos",5000,4);
	   gPlayerClass[playerid] = 1;
	   SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
	   SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
	   SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
	   SetPlayerInterior(playerid,0);
	  }
	  else if(classid == 2)
	  {
	   GameTextForPlayer(playerid,"~r~Attack Madd Dogg's crib",5000,4);
	   gPlayerClass[playerid] = 2;
	   SetPlayerPos(playerid,-385.2374,2205.9893,51.8531);
	   SetPlayerCameraPos(playerid,-379.7361,2207.0349,50.3879);
	   SetPlayerCameraLookAt(playerid,-385.2374,2205.9893,51.8531);
	   SetPlayerInterior(playerid,0);
	  }
	  return 1;
}



Re: GAMEMODE PROBLEM ! - samperzo - 03.06.2010

thanks everyone it works!