SA-MP Forums Archive
How i can make Gold Pot!! - 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: How i can make Gold Pot!! (/showthread.php?tid=130094)



How i can make Gold Pot!! - [WSM]Deadly_Evil - 25.02.2010

Hi guys i wanted to make an Gold Pot system!!
EXAMPLE:
Gold Pot game is started (Hint: LS Dock) Find Gold Pot!
This will add there small checkpoint... and when he enter the checkpoint that means he wins!
And can anybody give me an Example to how to make at least 2 Gold Pots Hints and Locations(I can add X,Y,Z Don't need)



Re: How i can make Gold Pot!! - aircombat - 25.02.2010

use
CreatePickup https://sampwiki.blast.hk/wiki/CreatePickup
________
Toyota progr?s


Re: How i can make Gold Pot!! - pierhs - 25.02.2010

Here its a code i did now.Its not tested:


pawn Code:
forward ChooseSpot();

new GoldPotSpot[MAX_PLAYERS];

GoldPotSpot[playerid]; // Add this to OnPlayerConnect

SetTimer("ChooseSpot", 60000, 1); // Its a repeated timer every min.Change it if u want.Add it to OnGameModeInit(); function

public ChooseSpot()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    switch (GoldPotSpot[i])
    {
      case 1: SetPlayerCheckpoint(i, x, y, z, 4.0);
      case 2: SetPlayerCheckpoint(i, x, y, z, 4.0); // Somewhere else
    }
  }
  return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
  if(GoldPotSpot[playerid] == 1)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here
  }
  else if(GoldPotSpot[playerid] == 2)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here too
  }
}



Re: How i can make Gold Pot!! - [WSM]Deadly_Evil - 25.02.2010

Yeah the code is correct ! working fine... But how i can create Hint System in it ?


Re: How i can make Gold Pot!! - Julian2574 - 25.02.2010

pawn Code:
forward ChooseSpot();

new GoldPotSpot[MAX_PLAYERS];

GoldPotSpot[playerid]; // Add this to OnPlayerConnect

SetTimer("ChooseSpot", 60000, 1); // Its a repeated timer every min.Change it if u want.Add it to OnGameModeInit(); function

public ChooseSpot()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    switch (GoldPotSpot[i])
    {
      case 1: SetPlayerCheckpoint(i, x, y, z, 4.0);S
      SendMessageToAll(); // Add a Message here ...
      case 2: SetPlayerCheckpoint(i, x, y, z, 4.0); // Somewhere else
    }
  }
  return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
  if(GoldPotSpot[playerid] == 1)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here
  }
  else if(GoldPotSpot[playerid] == 2)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here too
  }
}
check ..


Re: How i can make Gold Pot!! - [WSM]Deadly_Evil - 25.02.2010

Thanks! But how i can add more checkpoints in OnPlayerEnterCheckPoint?
pawn Code:
if(GoldPotSpot[playerid] == 1)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here
  }
  else if(GoldPotSpot[playerid] == 2)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here too
  }
}
How i can add More!
Like this?:
pawn Code:
if(GoldPotSpot[playerid] == 2)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here
  }
  else if(GoldPotSpot[playerid] == 3)
  {
    GoldPotSpot[playerid] = 0;
    // Do something here too
  }
}
And want to add Name SendClientMessageToAll in OnPlayerEnterCheckPoint But it gives me so many errors!! Plz see what i miss:
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
new string [128];
new pName[MAX_PLAYER_NAME];
if(GoldPotSpot[playerid] == 1)
  {
    GoldPotSpot[playerid] = 0;
    GivePlayerMoney(playerid, 7000);
    //new string [128];
    //new pName[MAX_PLAYER_NAME];
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 20 );
    GetPlayerName(playerid, pName, sizeof(pName));
      format(string, sizeof(string), "GoldPOT: %s(%d) has found the gold pot worth $70000 & 20 score!!", pName, playerid);
      SendClientMessageToAll(COLOR_GREEN, string);
      SendClientMessageToAll(playerid,COLOR_YELLOW,"A new game will be started in some minutes!");
  }
  else if(GoldPotSpot[playerid] == 2)
  {
    GoldPotSpot[playerid] = 0;
    GivePlayerMoney(playerid, 7000);
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 20 );
    //new string [128];
      // new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
      format(string, sizeof(string), "GoldPOT: %s(%d) has found the gold pot worth $70000 & 20 score!!", pName, playerid);
      SendClientMessageToAll(COLOR_GREEN, string);
      SendClientMessageToAll(playerid,COLOR_YELLOW,"A new game will be started in some minutes!");
  }
}
  return 1;
}



Re: How i can make Gold Pot!! - Jeffry - 25.02.2010

I suggest you like I made it.
Use pickups. Or you need a checkpoint streamer.


Re: How i can make Gold Pot!! - [WSM]Deadly_Evil - 25.02.2010

I have already (CPS by DragSta) but help me with OnPlayerEnterCheckpoint check the Upper Post!



Re: How i can make Gold Pot!! - Jeffry - 25.02.2010

Just always

if...
if...
if...


Thats how I made with pickups. I dont like the else.