[FilterScript] RCookies - The first reward system that fits all the kinds of servers
#7

Quote:
Originally Posted by Meller
View Post
PHP Code:
#define DIALOG_COOKIE   1 
Dialogs starts their ID at (0) just like any other ID formatted function.

PHP Code:
enum CookieInfo
{
    
Cookies,
    
RLevel
}
new 
cInfo[MAX_PLAYERS][CookieInfo]; 
Seems useless to me to use an enum for 2 variables, could've just done this.
PHP Code:
new cInfo[MAX_PLAYERS][2]; 
PHP Code:
stock Path(playerid)
{
    new 
str[128],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    
format(str,sizeof(str),UserPath,name);
    return 
str;

Why is this a stock, better yet, why is it a function?

PHP Code:
stock GetName(playerid)
{
    new 
name[24];
    
GetPlayerName(playerid,name,24);
    return 
name;

Again, why is it a stock? Plus, this and the other function above serves no intentional usage, pure lazyness.

PHP Code:
stock NotAuthorized(playerid)
{
SendClientMessage(playeridCOLOR_GREY"You don't have permission to use this command.");

This makes no sense to be a stock, or even a function.. Like why..

PHP Code:
stock PlayerName(playerid)
{
new 
pname[MAX_PLAYER_NAME];
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
return 
pname;

You already declared one "GetPlayerName" function, clearly you've copy pasted this.

PHP Code:
SetPlayerHealth(playerid99.00);
and
SetPlayerArmour(playerid99.00); 
Why 99.0 and not 100.0?

PHP Code:
GivePlayerWeapon(playerid34100);
                            
GivePlayerWeapon(playerid29300);
                            
GivePlayerWeapon(playerid31200); 
You should learn to use MACROs from start, I.E: WEAPON_BRASSKNUCKLE

PHP Code:
new Float:XFloat:YFloat:Z;
                            
GetPlayerPos(playeridXYZ);
                            
CreateVehicle(522X+4YZ82.2873, -1, -160); 
You're setting the vehicle's position 4 units->east. This makes the vehicle in risk of being spawned inside of an object.
You're also setting the angle to 82.2-.. Why not use GetPlayerFacing Angle?
Also, last but not least, you're not checking whether the player is in a virtual world, interior or w/e.
(look up PutPlayerInVehicle as well)

PHP Code:
CMD:rewarderhelp(playerid,params[])
{
    if(
cInfo[playerid][RLevel] == 1)
    {
        
SendClientMessage(playeridCOLOR_LB,"Junior Rewarder : /givecookie - /givecookieall - /rewardrehelp");
    }
    if(
cInfo[playerid][RLevel] == 2)
    {
        
SendClientMessage(playeridCOLOR_LB,"Junior Rewarder : /givecookie - /giveallcookie - /rewardrehelp");
        
SendClientMessage(playeridCOLOR_LB,"General Rewarder : /setcookies");
    }
    if(
cInfo[playerid][RLevel] == || (IsPlayerAdmin(playerid)))
    {
        
SendClientMessage(playeridCOLOR_LB,"Junior Rewarder : /givecookie - /givecookieall - /rewardrehelp");
        
SendClientMessage(playeridCOLOR_LB,"General Rewarder : /setcookies");
        
SendClientMessage(playeridCOLOR_LB,"Head Rewarder : /makerewarder");
    }
    else
    {
        
NotAuthorized(playerid);
    }
    return 
1;

Look up switch() for better optimization and stylish design.

PHP Code:
if(level || level 0
Can be replaced with
PHP Code:
if(level 3
PHP Code:
if (level == 0) return SendClientMessage(targetidCOLOR_LB,"You have beeen fired from your position as a rewarder");
        if (
level == 1) return SendClientMessage(targetidCOLOR_LB,"You have been set as a Junior Rewarder");
        if (
level == 2) return SendClientMessage(targetidCOLOR_LB,"You have been set as a General Rewarder");
        if (
level == 3) return SendClientMessage(targetidCOLOR_LB,"You have been set as a Head Rewarder"); 
Again, use switch()





Code is not well-looking at all, try fixing it and making the filterscript useful(being the keyword here) and release it again.
1. Enum gives the liberty to name variables, why not use enum? If the script were to grow later, it will be extremely confusing with the way you mentioned.
2. NotAuthorized stock can be useful if the filterscript is to grow more, better than writing SCM over and over, plus what's wrong with a stock?
(I personally use the same approach while writing gamemodes.)

3.
Code:
if(0 < level > 3)
Readibilty of the code is preferred over anything, especially since this is a script by rookie for rookies.
Same goes for switch and if-else issue that you mentioned. Switch only impoves the script by few nanoseconds, but like I said, readibility over anything.

I'm not trying to limit R4nd4ll's knowledge or trying to make an arguement over here.
Reply


Messages In This Thread
RCookies - The first reward system that fits all the kinds of servers - by R4nd4ll - 20.11.2017, 17:11
Re: RCookies - The first reward system that fits all the kinds of servers - by Ritzy - 20.11.2017, 17:42
Re: RCookies - The first reward system that fits all the kinds of servers - by R4nd4ll - 20.11.2017, 17:45
Re: RCookies - The first reward system that fits all the kinds of servers - by billy1337samp - 20.11.2017, 18:39
Re: RCookies - The first reward system that fits all the kinds of servers - by Meller - 20.11.2017, 19:00
Re: RCookies - The first reward system that fits all the kinds of servers - by R4nd4ll - 20.11.2017, 19:05
Re: RCookies - The first reward system that fits all the kinds of servers - by Ritzy - 20.11.2017, 19:35
Re: RCookies - The first reward system that fits all the kinds of servers - by Meller - 20.11.2017, 19:50
Re: RCookies - The first reward system that fits all the kinds of servers - by rfr - 26.11.2017, 15:14
Re: RCookies - The first reward system that fits all the kinds of servers - by GhostHacker9 - 26.11.2017, 16:23
Re: RCookies - The first reward system that fits all the kinds of servers - by rfr - 26.11.2017, 18:22
Re: RCookies - The first reward system that fits all the kinds of servers - by Marshall32 - 27.11.2017, 02:12
Re: RCookies - The first reward system that fits all the kinds of servers - by admantis - 27.11.2017, 02:32
Re: RCookies - The first reward system that fits all the kinds of servers - by AlexMSK - 27.11.2017, 03:24
Re: RCookies - The first reward system that fits all the kinds of servers - by FrezQ - 27.11.2017, 05:54

Forum Jump:


Users browsing this thread: 1 Guest(s)