Hello As i have Released In Past Robbing System but it was Broken Script So here is the advanced way to add it
Credits : [UF]Decent_946
First Add on Commands
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "robskills" )
{
MessagePlayer( "Your robbing skill are: " + GetRobskills(player) + "." ,player );
}
}
Now Work On Functions
Add this on ScriptLoad
RobbingSystem();
LoadPickups();
pstats <- array(GetMaxPlayers(), null);
now on Functions.nut
function RobbingSystem()
{
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Robskills( Name TEXT),Robskill NUMERIC )" );
}
function GetRobskills( player )
{
local Robbing = GetSQLColumnData( QuerySQL( db, "SELECT Robskill FROM Robskills WHERE Name='" + player.Name+"'" ), 0 );
if ( Robbing ) return Robbing;
else return 0;
}
function SetRobskills( player, rob )
{
QuerySQL(db, "UPDATE Robskills SET Robskill='" + rob.tointeger() + "' WHERE Name='" + player.Name + "'");
}
Now Lets Move to PickupPickup
function onPickupPickedUp( player, pickup )
{
if ( pickup.Model == 408 )
{
Message("[#FF0000]"+ player.Name +" has Robbing the "+ GetDistrictName( player.Pos.x, player.Pos.y ) +"");
SetRobskills(player,GetRobskills(player)+1);
Announce( "~y~ You have Robbed :25000", player )
player.Cash += 25000;
pickup.RespawnTime = 30000;
}
}
Now CreatePickups
function LoadPickups()
{
CreatePickup(408, Vector( 204.29, -490.98, 11.06 ));
CreatePickup(408, Vector(-854.526, -631.75, 11.3756 ));
CreatePickup(408, Vector(-688.706, -1262.49, 16.3473 ));
CreatePickup(408, Vector(-665.025, -1484.42, 13.8016 ));
CreatePickup(408, Vector(-885.324, -469.998, 13.1111 ));
CreatePickup(408, Vector(-847.002, -71.6495, 11.5405 ));
CreatePickup(408, Vector(-1079.64, -275.416, 12.0882 ));
CreatePickup(408, Vector(-1036.4 81.2033, 11.6515 ));
CreatePickup(408, Vector(-992.73, 200.392, 15.2213 ));
CreatePickup(408, Vector(-830.158, 741.534, 11.2885 ));
CreatePickup(408, Vector(-906.182, 799.715, 11.4546 ));
CreatePickup(408, Vector(-854.047, 85 11.3846 ));
CreatePickup(408, Vector(-754.53, 1342.74, 11.767 ));
CreatePickup(408, Vector(472.16, 1009.2, 19.1493 ));
CreatePickup(408, Vector(423.496, 1039.0 18.9648 ));
CreatePickup(408, Vector(364.464, 1075.12, 19.0649 ));
CreatePickup(408, Vector(470.443, 1208.18, 19.0094 ));
}
Enjoy ;)
If you find any problem feel free to post here
nice
wut?
onPlayer Class
Robskill = 0;
Cash = 0;
what is this?
lol, improve it, you do queries all the time, this will lag the shit out of the server if the PC is slow and there are many players :p
It don't when you have a good pc :)
I was going to create in hash but i think queries will be better
@Kewun Code Updated
Quote from: Finch Real on Jul 19, 2016, 08:50 AMIt don't when you have a good pc :)
I was going to create in hash but i think queries will be better
Why not create a class and store the information in variables, that will be lot more easier to understand as well as efficient.
Even if you have a good PC, it might.
Well I am in love with queries
But i will create in classes when i get back at home :)
......ok cool....
So, here's a efficient version of it( untested ), I've left scripting in Squirrel long ago, so, it may contain bugs. It's just an example of how to do that shit efficiently.
Link: http://pastebin.com/qwxYQu8e
Well Its Good Example But i think that could be difficult for newbies to handle it so this one is. Most simple example Deal with it ;)
Quote from: Finch Real on Jul 19, 2016, 02:28 PMWell Its Good Example But i think that could be difficult for newbies to handle it so this one is. Most simple example Deal with it ;)
You're too stubborn... Well, what do you think? If the newbies don't learn, then they can never script, for example: you.
I've explained that example with comments and other things so it's easy to edit and see for any ONE!
You've neither commented anything nor did you give some space which would make it easier to read and understand.
Yeah That's True I can't script that hard but i still love this way with db
Quote from: Finch Real on Jul 19, 2016, 08:39 AMfunction SetRobskills( player, rob )
{
QuerySQL(db, "UPDATE Robskills SET Robskills='" + rob.tointeger() + "' WHERE Name='" + player.Name + "'");
}
wtf
Updated!
Quote from: Finch Real on Jul 20, 2016, 06:04 AMUpdated!
wtf did you update? I see nothing new lol
There was a bug Which will not increase robskill that's what i fix
And error:
the index db does not exists
line:
QuerySQL( db, "CREATE TABLE IF NOT EXISTS Robskills( Name TEXT),Robskill NUMERIC )" );
in the RobbingSystem() function
:/
db <- ConnectSQL(".sql");
where put this? onscirpt load?
yah
Sorry For Inactivity
@Kewun Don't you use database system? If no so add this
db <- ConnectSQL( "rob.sql" );
already fixed
Thanks Thanks Thanks Thanks Thanks
WORKING 1000000000% Thanks
Admins i think there is no need for adding like button on any board. :-\ :-\
QuoteI think one more rule needs to be added if any one bump for shity comment his warn lvl will be increased.
Quote from: zeus on Dec 08, 2016, 10:05 AMAdmins i think there is no need for adding like button on any board. :-\ :-\
QuoteI think one more rule needs to be added if any one bump for shity comment his warn lvl will be increased.
No, bump is required too. And, you can bump any topic on the off-topic section if its worth it.
Quote from: KAKAN on Dec 08, 2016, 12:21 PMQuote from: zeus on Dec 08, 2016, 10:05 AMAdmins i think there is no need for adding like button on any board. :-\ :-\
QuoteI think one more rule needs to be added if any one bump for shity comment his warn lvl will be increased.
No, bump is required too. And, you can bump any topic on the off-topic section if its worth it.
And this is not off-topic section.
Cough, people, for God Sake! Stop bumping old topics just to get useless notifications...