20.11.2016, 06:43
can you guys help me in making a /mb command so players can see hints that is given
here is the code
here is the code
PHP код:
public ChangeStage()
{
switch( gCurrStage )
{
case STAGE_INVALID:
{
if(moneybag == 0)
{
new _rand = random(sizeof(g_MoneyBagSpawns)), _string[128];
gMoneyBag = CreatePickup(PICKUP_MODEL_ID, 2, g_MoneyBagSpawns[_rand][0], g_MoneyBagSpawns[_rand][1], g_MoneyBagSpawns[_rand][2], 0);
gCurrPrize = ( random( (PRIZE_UPPER_LIMIT - PRIZE_LOWER_LIMIT) ) + PRIZE_LOWER_LIMIT );
for(new i = 0; i < 3; i++)
{
g_fCurrPos[i] = g_MoneyBagSpawns[_rand][i];
}
format(_string, sizeof(_string), "{4AE8E8}INFO: {FFFFFF}A moneybag (worth $%s) has been spawned!", AddCharComma(gCurrPrize));
SendClientMessageToAll(-1, _string);
gCurrStage = STAGE_SPAWNED ;
clue1 =1;
}
else
{
//////////no mb
}
}
case STAGE_SPAWNED:
{
if(moneybag == 0)
{
new _string[128], _loc[30];
Get2DZone(g_fCurrPos[0], g_fCurrPos[1], _loc, sizeof(_loc));
format(_string, sizeof(_string), "{4AE8E8}INFO: {FFFFFF}The money bag is in '%s'.", _loc);
SendClientMessageToAll(-1, _string);
gCurrStage = STAGE_REVEAL_LOC ;
clue2 =1;
}
else
{
//////////no mb
}
}
case STAGE_REVEAL_LOC:
{
if(moneybag == 0)
{
new cPlayer = GetClosestTo(g_fCurrPos[0], g_fCurrPos[1], g_fCurrPos[2]),
_string[128];
if( cPlayer != INVALID_PLAYER_ID )
{
new _name[ MAX_PLAYER_NAME ];
GetPlayerName(cPlayer, _name, MAX_PLAYER_NAME);
format(_string, sizeof(_string), "{4AE8E8}INFO: {4AE8E8}%s (%d){FFFFFF} is closest to the money bag!", _name, cPlayer);
}
else format(_string, sizeof(_string), "{4AE8E8}INFO: {FFFFFF}There is no one close to the money bag, yet.");
SendClientMessageToAll(-1, _string);
gCurrStage = STAGE_REVEAL_CLP;
clue3=1;
}
else
{
//////////no mb
}
}
case STAGE_REVEAL_CLP:
{
if(moneybag == 0)
{
new clPlayer = GetClosestTo(g_fCurrPos[0], g_fCurrPos[1], g_fCurrPos[2]),
Float: fDist,
_string[128];
if( clPlayer != INVALID_PLAYER_ID)
{
new _name[MAX_PLAYER_NAME];
fDist = GetPlayerDistanceFromPoint(clPlayer, g_fCurrPos[0], g_fCurrPos[1], g_fCurrPos[2]);
GetPlayerName(clPlayer, _name, MAX_PLAYER_NAME);
format(_string, sizeof(_string), "{4AE8E8}INFO: {FFFFFF}The distance of the closest player - {4AE8E8}%s (%d) - {FFFFFF}from the money bag is %d metres.", _name, clPlayer, floatround(fDist));
clue4=1;
}
else
format(_string, sizeof(_string), "{4AE8E8}INFO: {FFFFFF}There is no one yet close the the money bag!");
SendClientMessageToAll(-1, _string);
gCurrStage = STAGE_REVEAL_DIS;
}
else
{
//////////no mb
}
}
case STAGE_REVEAL_DIS:
{
if(moneybag == 0)
{
SendClientMessageToAll(-1, "{4AE8E8}INFO: {FFFFFF}No one could find the money bag, and it has been reset!");
DestroyPickup(gMoneyBag);
gMoneyBag = -1;
gCurrStage = STAGE_INVALID;
}
else
{
//////////no mb
}
}
}
return 1;
}