Random pickup hints
#1

I don't really like asking for help, but i'm woundering how to do something like this, When a admin does /randompickup a random pickup will be made,
with the hint where it is, I already have this:

pawn Код:
new Float:RandomMoney[][6] =
{
    {2538.1797,-1630.1400,13.5541},
    {-2508.3176,-687.8477,139.3203},
    {2141.5942,-1163.3561,23.9922},
    {655.1508,-564.9355,16.3359},
    {248.7421,-57.9909,1.5703}
};
pawn Код:
if(strcmp(cmdtext, "/randommoney", true) == 0) {
      if(Pinfo[playerid][Level] >= 6){
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(string,sizeof string, "Administrator: %s has started the money pickup event, You must find it.", name);
        SendClientMessageToAll(COLOR_RED, string);
        new rand = random(sizeof(RandomMoney));
        moneypickup = CreatePickup(1550, 2, RandomMoney[rand][0], RandomMoney[rand][1], RandomMoney[rand][2], -1);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "You do not have access to this command.");
}
And the OnPlayerPickup stuff...

It works fine, but i want to know how to add the hint where it is.

Like, "Administrator: %s has started the money pickup event, Hint: %d".

Thanks for help...
Reply
#2

I'm not sure but you could try this:

Add this at bottom of your code:

pawn Код:
stock GetRandomHint(Pickup)
{
    new string[50];
    switch(Pickup)
    {
        case 0: format(string, sizeof(string), "near the station");
        case 1: format(string, sizeof(string), "at the stadium");
        case 2: format(string, sizeof(string), "under a bridge in LS/Ganton");
        case 3: format(string, sizeof(string), "upon a tower in LV");
        case 4: format(string, sizeof(string), "in LSPD of Las Venturas");
        case 5: format(string, sizeof(string), "at ship in LV");
        //So many cases as you have pickups.
    }
    return string;
}
Command:
pawn Код:
if(strcmp(cmdtext, "/randommoney", true) == 0) {
      if(Pinfo[playerid][Level] >= 6){
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(string,sizeof string, "Administrator: %s has started the money pickup event.", name);
        SendClientMessageToAll(COLOR_RED, string);
        new rand = random(sizeof(RandomMoney));
        moneypickup = CreatePickup(1550, 2, RandomMoney[rand][0], RandomMoney[rand][1], RandomMoney[rand][2], -1);
        format(string,sizeof string, "Hint: The pickup is %s.", GetRandomHint(rand));
        SendClientMessageToAll(COLOR_RED, string);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "You do not have access to this command.");
}
Let me know if it works. I just typed it fastly.

Greetz.
Reply
#3

It worked perfectly, Thank you Jeffry.
Reply
#4

Ah, thats nice. Have fun with it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)