How i can make Gold Pot!!
#1

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)
Reply
#2

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

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
  }
}
Reply
#4

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

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 ..
Reply
#6

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;
}
Reply
#7

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

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

Just always

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


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


Forum Jump:


Users browsing this thread: 3 Guest(s)