02.01.2012, 17:26
Hello SAMP Community!
Today i want to show you, a tutorial how you create random Servermessages
What we need:Today i want to show you, a tutorial how you create random Servermessages
1. Pawno
2. Brain
3. A little bit of your lifetime
So Let`s go!
At first we define a forward at the top of the script:
Code:
forward Servermessage();
Code:
public OnGameModeInit
Code:
SetTimer("Servermessage",1800000,1);
SetTimer = CreateTimer
Servermessage= function of the timer
1 = [true] Is for repeating [2=[false] Is for not repeating]
So, we have created a Timer, but he isn`t helpfull!
You make in your Script a new public, like that:
Code:
public Servermessage()
{
return 1;
}
We add this (
Code:
new rand = random(2);
Code:
public Servermessage()
{
new rand=random(2);
return 1;
}
new rand mean, that we create a new variable
random(2) , because Pawno select the case 0 or case 1!
Now it`s look like this:
Code:
public Servernachricht()
{
new rand=random(2);
return 1;
}
Code:
switch(rand)
{
case 0: //If random select case 0
{
SendClientMessageToAll(-1,"Your Message!");
}
case 1: //If Random select case 1
{
SendClientMessageToAll(-1,"Your Message!");
}
It look`s now like this:
Code:
public Servernachricht()
{
new rand=random(2);
switch(rand)
{
case 0:
{
SendClientMessageToAll(-1,"Your Message!");
}
case 1:
{
SendClientMessageToAll(-1,"Your Message!");
}
return 1;
}
Feedback is Welcome!
Greetz,
#Pwn.

