Random Messages Help - 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: Random Messages Help (
/showthread.php?tid=628376)
Random Messages Help -
silverms - 09.02.2017
hey so I have made an server random messages system it is working ood no bugs but is there is a way to add and delete the random messages in game?, my gamemode uses dini if required and here is the code
Код:
#define CURRENT_MESSAGES 18
#define MESSAGE_COLOR 0xFFFF00FF
#define MESSAGE_INTERVAL 160
//#define Msg_Name "TIP:"// this name of the random message under testing
new RM[CURRENT_MESSAGES][128];
forward SendRandomMessage();
public OnGameModeInit()
{
RandomMsg();
return 1;
}
public SendRandomMessage()
{
static lastmessage = 0;
new rand = random(CURRENT_MESSAGES);
while(rand == lastmessage && CURRENT_MESSAGES != 1) { rand = random(CURRENT_MESSAGES); }
lastmessage = rand;
SendClientMessageToAll(MESSAGE_COLOR, RM[lastmessage]);
}
stock AddRandomMessage(text[])
{
for(new m; m < CURRENT_MESSAGES; m++)
{
if(!strlen(RM[m]))
{
strmid(RM[m], text, 0, 127);
return 1;
}
}
return 0;
}
stock RandomMsg()
{
AddRandomMessage("TIP: Type /drivingschool To Get Teleported To The Next Driving School.");
AddRandomMessage("TIP: Type /help to see a short list of our server helpful commands.");
AddRandomMessage("TIP: The flying school is located at Verdant Meadows, LV.");
AddRandomMessage("TIP: Type /resetcar to reset your own vehicle to the closest police department.");
AddRandomMessage("TIP: The bike school is located at Blackfield, LV.");
AddRandomMessage("TIP: Use /findjob while in vehicles to see our server jobs which can generate money.");
AddRandomMessage("TIP: Use /ask whenever there's a support operator on-duty.");
AddRandomMessage("TIP: Have you seen someone breaking rules/cheating ?? /report is the solution.");
AddRandomMessage("TIP: Type /vhelp to view all vehicles commands.");
AddRandomMessage("TIP: Every 1 hour of playing = 1 score, at level 15 you can buy an own house, at 25 an own business.");
AddRandomMessage("TIP: Use /admins to see the online adminstrators.");
AddRandomMessage("TIP: To see enabled events use /events.");
AddRandomMessage("TIP: VIP member Level 1 get 2.500.000$ cash in-game, VIP member Level 2 get 5.000.000$ cash in-game.");
AddRandomMessage("TIP: VIP member level 1 can own 3 vehicles, VIP level 2 can own 6 vehicles.");
AddRandomMessage("TIP: VIP members don't lose their money, armor and weapons while dying. also they don't lose their vehicle when its destroyed.");
AddRandomMessage("TIP: Use /radio While In Car For Some New Music.");
SetTimer("SendRandomMessage", MESSAGE_INTERVAL * 1000, 1);
return 1;
}
Re: Random Messages Help -
silverms - 02.03.2017
hello
?
Re: Random Messages Help -
JessThompson - 03.03.2017
You would need to create a command that uses your saving system to add a message to a file. Then once you have added the message you will need to reload that file. It would be easier if your gamemode was mysql as its more dynamic.