[Help] Random Pickup -
borisblat - 14.05.2009
I tried to do activity with Gold Pot:
Код:
new PotPlayer[256] = 0;
new PotStatus = 0;
new Pot;
new playername[MAX_PLAYER_NAME];
new Clue = 0;
new Reward;
new knob[256];
new PotWinner;
new PotJoin = 0;
new Float:PotSpawns[][3] = {
{-2225.3716,2326.9734,7.5469},
{-2747.8416,-315.7603,7.1952} };
Код:
if(strcmp(cmd, "/StartPot", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 5) return DenyMessage(playerid, 5);
if (PotStatus == 1) {
SendClientMessage(playerid , COLOR_WHITE, ".йщ лбш фтймеъ");
} else if (PotStatus == 0) {
PotStatus = 1;
format(knob, sizeof(knob), "~B~~H~ /Pot", playername);
GameTextForAll(knob,3000,4);
SetTimer("PotStart",3000,0);
}
return 1;
}
if(strcmp(cmd, "/EndPot", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 5) return DenyMessage(playerid, 5);
if (PotStatus == 0)
SendClientMessage(playerid,COLOR_WHITE, ".ма оефтъ Pot дфтймеъ");
else if (PotStatus == 1) {
PotStatus = 0;
SendClientMessageToAll(COLOR_WHITE, ".дагойп бйим аъ фтймеъ зфщ аъ доиоеп");
}
return 1;
}
if(strcmp(cmd, "/Pot", true) == 0)
{
if (PotPlayer[playerid] == 1)
SendClientMessage(playerid, COLOR_WHITE, "!аъд лбш бфтймеъ, йбржерд");
if(PotStatus == 1 && PotPlayer[playerid] == 0) {
if (PotJoin == 0) {
SendClientMessage(playerid, COLOR_LIGHTBLUEGREEN, ".дцишфъ мзфщ аъ доиоеп бдцмзд");
PotPlayer[playerid] = 1;
GetPlayerName(playerid, playername, sizeof(playername));
} else if (PotJoin == 1)
SendClientMessage(playerid, COLOR_LIGHTBLUEGREEN, ".ддшщод рсвшд");
} else if (PotStatus == 0) {
SendClientMessage(playerid, COLOR_WHITE, ".айп фтймеъ щм оца аъ доиоеп");
return 1;
}
if(strcmp(cmd, "/Clues", true) == 0)
{
if (PotStatus == 0)
SendClientMessage(playerid, COLOR_WHITE, ".айп фтймеъ щм оца аъ доиоеп");
else if (PotStatus == 1 && PotPlayer[playerid] == 0)
SendClientMessage(playerid, COLOR_WHITE, ".тмйк мдшщн мфтймеъ лгй мшаеъ аъ дшожйн");
else if (PotStatus == 1 && PotPlayer[playerid] == 1) {
if (Clue >= 1)
SendClientMessage(playerid, COLOR_WHITE, " San Fierro шож 1: роца мйг дтйш");
if (Clue >= 2)
SendClientMessage(playerid, COLOR_WHITE, " шож 2: роца мйг ожз, еорзъ осечйн");
if (Clue >= 3)
SendClientMessage(playerid, COLOR_WHITE, " BaySide шож 3: дтййшд");
}
}
return 1;
}
Код:
forward PotStart();
public PotStart() {
SendClientMessageToAll(COLOR_LIGHTGREEN, "------------- [ /Pot ] ------------");
SendClientMessageToAll(COLOR_WHITE, " GoldPot ршщод ддшщод мфтймеъ ");
SendClientMessageToAll(COLOR_WHITE, " /Pot :мдцъшфеъ мфтймеъ дчщ/й");
SendClientMessageToAll(COLOR_WHITE, " $50000 :дфшс морцз/ъ");
SendClientMessageToAll(COLOR_LIGHTGREEN, "_____________________________________");
SetTimer ("PotClose",40000,0);
PotJoin = 0;
SetTimer ("Clue1",15000,0);
new rand = random(sizeof(PotSpawns));
Pot = CreatePickup (1274,2,PotSpawns[rand][0], PotSpawns[rand][1], PotSpawns[rand][2]);
return 1; }
forward PotClose ();
public PotClose ()
{
PotJoin = 1;
return 1;
}
forward Clue1 ();
public Clue1 ()
{
Clue = 1;
SendClientMessageToAll(COLOR_WHITE, "------------[Hidden Pot]------------");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " San Fierro шож шащеп: роца мйг дтйш");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " [ма тебг лшвт] /Clues - мшщйоъ дшожйн");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " .дшож дба, бтег л2 гчеъ");
SendClientMessageToAll(COLOR_WHITE, "____________________________________");
SetTimer ("Clue2",120000,0);
return 1;
}
forward Clue2 ();
public Clue2 ()
{
if (PotStatus == 1) {
Clue = 2;
SendClientMessageToAll(COLOR_WHITE, "------------[Hidden Pot]------------");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " шож щрй: ожз, орзъ осечйн ");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " [ма тебг лшвт] /Clues - мшщйоъ дшожйн");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " .дшож дба, бтег л2 гчеъ");
SendClientMessageToAll(COLOR_WHITE, "____________________________________");
SetTimer ("Clue3",120000,0);
} else
return 1;
}
forward Clue3 ();
public Clue3 ()
{
if (PotStatus == 1) {
Clue = 3;
SendClientMessageToAll(COLOR_WHITE, "------------[Hidden Pot]------------");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " BaySide шож щмйщй: дтййшд ");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " [ма тебг лшвт] /Clues - мшщйоъ дшожйн");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " .жде дшож дазшеп");
SendClientMessageToAll(COLOR_WHITE, "____________________________________");
} else
return 1;
}
It works good when there is only one Pickup.
but,
I want that i will be a few more pots (random)
so i did the function "random"..
but the problem with the clues, how can i know witch pot selected?
Re: [Help] Random Pickup -
Limex - 14.05.2009
new rand = random(sizeof(PotSpawns));
You could add a variable at he top SelectedPot.
So like instead "SelectedPot = random(sizeof(PotSpawns));"
Re: [Help] Random Pickup -
borisblat - 14.05.2009
but what is the diffrence?
have to do that so it will be like this:
Код:
forward Clue3 ();
public Clue3 ()
{
if (PotStatus == 1) {
CASE 1
Clue = 3;
SendClientMessageToAll(COLOR_WHITE, "------------[Hidden Pot]------------");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " BaySide шож щмйщй: дтййшд ");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " [ма тебг лшвт] /Clues - мшщйоъ дшожйн");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " .жде дшож дазшеп");
SendClientMessageToAll(COLOR_WHITE, "____________________________________");
CASE 2
SendClientMessageToAll(COLOR_WHITE, "------------[Hidden Pot]------------");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " ....");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " [ма тебг лшвт] /Clues - мшщйоъ дшожйн");
SendClientMessageToAll(COLOR_LIGHTBLUEGREEN, " .жде дшож дазшеп");
SendClientMessageToAll(COLOR_WHITE, "____________________________________");
} else
return 1;
}
Re: [Help] Random Pickup -
Darkly_Face - 29.01.2010
I dont know.... ;(
maybe try this one?
Код:
new Float:PotSpawns[2][3] = { //PotSpawns[how much rand pots][3]
{-2225.3716,2326.9734,7.5469},
{-2747.8416,-315.7603,7.1952} };