Abuse-proof code
#1

Hey. As you can tell by the title it's about a code that should be Abuse-proof. What I made is:

PHP код:
new job[MAX_PLAYERS];
new 
employment[MAX_PLAYERS];
new 
builder[MAX_PLAYERS]; 
These are under "new" what I have to define of course. Now the script is:
PHP код:
CMD:employbuilder(playeridparams[])
{
    if(
builder[playerid] == 1SendClientMessage(playeridCOLOR_RED,"[ERROR]{FFFFFF}You're already employed as builder!");
    else if(
employment[playerid] == 1SendClientMessage(playeridCOLOR_RED"You already have a job!");
    else if(!
IsPlayerInRangeOfPoint(playerid,1895.7168,1729.1393,10.8153,5)) SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not at construction site");
    else
    {
        
SendClientMessage(playeridCOLOR_LIGHTGREEN"[SUCCESS!]{FFFFFF}You've employed yourself as a builder!");
        
employment[playerid] = 1;
        
builder[playerid] = 1;
    }
    return 
1;

That's to employ himself/herself

Here's to do the job.

PHP код:
CMD:startjob(playeridparams[])
{
if(
builder[playerid] == 0SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not employed as builder!");
else if(
job[playerid] == 1SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You already have a job going!");
else if(!
IsPlayerInRangeOfPoint(playerid5,1878.5900,1758.6154,10.4470)) SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not near construction site!");
{
job[playerid] = 1;
SendClientMessage(playeridCOLOR_LIGHTGREEN"[SUCCESS!]{FFFFFF}You've started gathering resources. Go through checkpoints to finish your job!");
SetPlayerCheckpoint(playerid,1880.6528,1759.2567,10.1134,2);
}
return 
1;

And to quit job:

PHP код:
CMD:quitbuilders(splayeridparams[])
{
    if(
employment[playerid] == || builder[playerid] == 0) return SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're already unemployed!");
    
SendClientMessage(playeridCOLOR_RED"You have quit builders. Good luck in new job!");
    
builder[playerid] = 0;
    
employment[playerid] = 0;
    return 
1;


I quite don't see that it can be bug-abused exploited or else, but I need your opinions, if you see that it's abusive tell me, so I can fix it right away. I found abusive parts but I did fix them.

---------------------------------------------------------------------------------------------------------------

Another question: How do I save that he is builder, that his job is builder, he has that much money and others? How do I save that, is there a filterscript for that or something?

---------------------------------------------------------------------------------------------------------------
Reply


Messages In This Thread
Abuse-proof code - by Bek_Loking - 26.06.2014, 12:28
Re: Abuse-proof code - by Clad - 26.06.2014, 12:32
Re: Abuse-proof code - by Bek_Loking - 26.06.2014, 12:39
Re: Abuse-proof code - by Clad - 26.06.2014, 12:42
Re: Abuse-proof code - by Bek_Loking - 26.06.2014, 12:44

Forum Jump:


Users browsing this thread: 1 Guest(s)