[FilterScript] Roll The Dice 0.1 - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Roll The Dice 0.1 (
/showthread.php?tid=159415)
Roll The Dice 0.1 -
ScottCFR - 13.07.2010
Roll The Dice
What is it?
A script that allows some one to type the command and receive a reward on a completely random basis.
What are the rewards?
There are 10 of them. On the current version it gives you nothing. You can add and remove things as needed.
What are the commands?
/RTD and /RollTheDice
Is there anywhere I can test it?
Yes! You can test it on my server [75.102.27.250:7800]
Anything else?
There is a system to prevent spam, you can remove this by removing the line (if(RTD[playerid] == 0)). Be sure to remove this. This system keeps the player from spamming the command. They can RTD once a server visit or after every death.
Download:
Version 0.1
Please report any bugs/suggestions for future versions.
**Creadits**
HellBoy - Random Function
HellBeast (AKA ScottCFR) - Rest of script
Re: Roll The Dice 0.1 -
Hiddos - 13.07.2010
Was your server IP really necessary?
Few notes:
You're never resetting the RTD variable(s).
Start using PVars
Don't return '1' at the end of OnPlayerCommandText, it'll disable the SERVER: Unknown Command.
You're using a lot of lines, which is unnecessary, example:
pawn Code:
switch(random(10))
{
case 1:
{
SendClientMessage(playerid, RED, "You've won nothing! 1/10");
RTD[playerid] = 1;
}
case 2:
{
SendClientMessage(playerid, RED, "You've won nothing! 2/10");
RTD[playerid] = 1;
}
case 3:
{
SendClientMessage(playerid, RED, "You've won nothing! 3/10");
RTD[playerid] = 1;
}
Case this case that. I'd say do it with a string:
pawn Code:
if(!strcmp(cmdtext, "/rtd", true))
{
if(RTD[playerid] == 0)
{
new string[128];
format(string,sizeof string,"You've won nothing! %d/10",random(10)+1);
SendClientMessage(playerid,RED,string);
}
else
{
SendClientMessage(playerid, RED, "You have already RTD'd today!!!");
}
return 1;
}
Other then that, it's good for a start.
Re: Roll The Dice 0.1 -
ScottCFR - 13.07.2010
EDIT: You were right. I forgot to add those functions, the first version was in my Gamemode, then rewrote into a FS.
The variables are reset OnPlayerDisconnect and OnPlayerDeath. Good Idea with the string, I'll update it. (and give you credit of coarse)
My server's IP is so people can test it. Obviously they can't go to my server without IP...
Re: Roll The Dice 0.1 -
ScottCFR - 13.07.2010
Updated, The case(s) are now using strings.