SA-MP Forums Archive
How To Add A TIP Bot - 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)
+--- Thread: How To Add A TIP Bot (/showthread.php?tid=322068)



How To Add A TIP Bot - wes231 - 29.02.2012

how to add a tip bot?


Re: How To Add A TIP Bot - Mike_Peterson - 29.02.2012

A tip bot.. you mean like a NPC that gives you advice.. or like in hotel? come on.. be more clear


Re: How To Add A TIP Bot - wes231 - 29.02.2012

uhm just like when players are walking around it the chat log says Tip Bot: Team Speak IP : 13221321321


Re: How To Add A TIP Bot - Mike_Peterson - 29.02.2012

Run a timer, loop through all players, check if they're near the NPC's position, SendClientMessage and maybe a random() because you dont want the same messages all the time.


Re: How To Add A TIP Bot - jameskmonger - 29.02.2012

I don't think he meant an NPC. Try this:
pawn Код:
public OnGameModeInit() {
   SetTimer("TipBot", (60000 * 10), true);
}

forward TipBot();
public TipBot() {
    new message = random(6);
    switch(message) {
        case 0: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 1");
        case 1: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 2");
        case 2: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 3");
        case 3: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 4");
        case 4: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 5");
        case 5: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 6");
        case 6: SendClientMessageToAll(COLOR_WHITE, "Tipbot: message 7");
    }
}
To add more, just increase the number in the brackets of the random function, and add more cases to the switch method.