Abuse-proof code -
Bek_Loking - 26.06.2014
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(playerid, params[])
{
if(builder[playerid] == 1) SendClientMessage(playerid, COLOR_RED,"[ERROR]{FFFFFF}You're already employed as builder!");
else if(employment[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "You already have a job!");
else if(!IsPlayerInRangeOfPoint(playerid,1895.7168,1729.1393,10.8153,5)) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're not at construction site");
else
{
SendClientMessage(playerid, COLOR_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(playerid, params[])
{
if(builder[playerid] == 0) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're not employed as builder!");
else if(job[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You already have a job going!");
else if(!IsPlayerInRangeOfPoint(playerid, 5,1878.5900,1758.6154,10.4470)) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're not near construction site!");
{
job[playerid] = 1;
SendClientMessage(playerid, COLOR_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(splayerid, params[])
{
if(employment[playerid] == 0 || builder[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're already unemployed!");
SendClientMessage(playerid, COLOR_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?
---------------------------------------------------------------------------------------------------------------
Re: Abuse-proof code -
Clad - 26.06.2014
I don't know what your question is, But to prevent people changing their job ect, Try to make a job contract of 2 Hours, Or to get the job you must have 1000 Dollars. There are no abusive parts here.
To save the money ect you must create register and login system, With jobs ect.
Re: Abuse-proof code -
Bek_Loking - 26.06.2014
Can I download one, will it still save?
Re: Abuse-proof code -
Clad - 26.06.2014
Quote:
Originally Posted by Bek_Loking
Can I download one, will it still save?
|
Ofcourse it will save, But it will save only what that filterscript works on, So, You'd better create your personal one
Re: Abuse-proof code -
Bek_Loking - 26.06.2014
Aw crap :S Well, I'm going to create my own one when I get used to pawno till then sajonara.