News:

Server address: server.convoytrucking.net
Get SA-MP 0.3.7 here: Click Here to download SA-MP 0.3.7

Main Menu

Saving Server Stats

Started by Dobby, January 07, 2013, 16:05

Dobby

Sorry if its posted in the wrong section.

I've downloaded a gamemode off the SAMP Forums, and I'm wondering. How the hell are stats saved? I'm a newb when it comes to scripting and what not, is it a SQL database thingy? Do I need to be connected to the internet? (I don't have an active connection at home currently)is there a way to save player stats? I've googled it, and I've come across the database thingy, and I don't want to download something and wait to download or add an alternative methods :)

Any help would be appreciated :D or you could code it for me, and tell me where to add the script to :)

Thanks, hope you understood!
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Ethan

stats off a server are saved in a MySql database so that if something happens, stats can easily be restored... and if you want to know more post on SAMP forums as thats the proper thing to go through to get your information

Dobby

Do they store offline mode? I'm playing on local host /: what's the actual program called that i gotta download for it to be right?
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Ethan

Quote from: DanielDawson on January 07, 2013, 17:21
Do they store offline mode? I'm playing on local host /: what's the actual program called that i gotta download for it to be right?


thats whats this http://forum.sa-mp.com/index.php is for

Joshy

#4
MySQL on a different server, regular backups.

Install XAMPP for Windows on your development machine and go to http://localhost/ - phpmyadmin will help you create, manage and maintain the databases from there.

Remember to escape your SQL! If you don't do this I will be disappointed and if I ever meet you in real life you will be subject to either a lecture on database security or just get slapped in the face. If your server ever gets compromised because of a crafty SQL injection, you can never say "no one told me about escaping my SQL" because I just told you.

mysql_real_escape_string(const source[], destination[], connectionHandle) or mysql_format()
http://wiki.sa-mp.com/wiki/MySQL#mysql_real_escape_string

Also don't be that fool who stores passwords in plaintext. http://plaintextoffenders.com/



Just noticed that you downloaded a gamemode... check if it escapes queries / hashes passwords before you put it on a live server.


You can store data in INI files(?) or just plain flatfiles, however it may be become difficult to expand and it's really difficult to have another system integrate with INI / flatfiles without it being on the same server.
[comment]test[/comment]
LAST SEEN
TOTAL TIME ON SERVER
SCORE
TRUCK LOADS
CONVOY SCORE
ACHIEVEMENTS
ARTIC
DUMPER
VAN
FUEL
CEMENT
ARRESTS
CARS STOLEN
COACH
PLANE
HELICOPTER
TOW TRUCK
LIMO
TRASH
ARMORED VAN
BURGLARIES
ARMORED VANS STOLEN
MISSIONS FAILED
OVERLOADED
FINES PAID
TOTAL SPENT ON FUEL
INTEREST EARNED
DISTANCE TRAVELLED
TIME IN JAIL
LAST MISSION
Generated using Azure Functions & CloudFlare Workers using the Convoy Trucking API. Updates every around 5 minutes. See the original SVG image. View source code (not updated with function yet)




mick88

Depends which gamemode you downloaded. Some gamemodes use textfiles or sqlite - these should just work. If you have a script with mysql, then you need to setup a mysql database - either local or on a remote server.

Dobby

I can't even remember the game mode name now, i gave up and went home, I've only just checked this thread again. There's a filterscript I've seen on SAMP forums, but I'm not too good at the errors, i wanna learn how to code :( I'm not too fussed about the game mode saving now, I'll just " /setscore [ID] " until i get internet back :) is it easy to make a list, like /cmds in CT? Here's the essay..
Things I've got:
Speedometer
House System
AdminScript /ban /kick etc
Car dealership
Some in game checkpoint maker (must be a mission maker :s) I'll take a look tomorrow. I think it would be cool to be able to see the /cmds in front of me instead of having to scroll up the chat to find the right one :) is this easy to do mick/joshy or ethen, whoever wants to answer, or is the pawn script only for convoy trucking? :)
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Matias

You spawn texts at screen like at CT using ShowPlayerDialog
http://wiki.sa-mp.com/wiki/ShowPlayerDialog
You should learn and ask much more at forum.sa-mp.com ,this is not a really good place for this since there are not too much scripters. At SAMP forum you get help very fast, try it.

Here are the basics you should learn: http://wiki.sa-mp.com/wiki/Scripting_Basics

Dobby

Sorry to add this, my phone won't let me select an "edit" option :s

I'll take a go at the SQL server tomorrow and report how i do :) would be interesting to learn

God I'm such a noob :( the people at sa-mp forum seem to follow the rule of its wrong to help someone out, and just reply with a typical search engine link :P thanks for the help, and continued help :) appreciate it. I've managed to get the whole .inc files working and getting vehicles to load in bare.pwn :) oh and I've got a fs that makes a message appear in blue in the chat box like "don't drive on train tracks" for example :) thanks for the help again!
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Matias

Quote from: DanielDawson on January 07, 2013, 22:32
Sorry to add this, my phone won't let me select an "edit" option :s

I'll take a go at the SQL server tomorrow and report how i do :) would be interesting to learn

God I'm such a noob :( the people at sa-mp forum seem to follow the rule of its wrong to help someone out, and just reply with a typical search engine link :P thanks for the help, and continued help :) appreciate it. I've managed to get the whole .inc files working and getting vehicles to load in bare.pwn :) oh and I've got a fs that makes a message appear in blue in the chat box like "don't drive on train tracks" for example :) thanks for the help again!

Dont try to make a gamemode first time, just try the basics functions of SA:MP till you learn them and then you are able to modify or create new gamemodes.

Dobby

I realised a gamemode was a bit out of my leauge lol, the grandlarc is perfect, but the house system doesn't seem to want to work for me on there :( as I've said, I've got the vehicle spawns from LVDM (only ones that i could c/p) into the pawn file, and get them to compile. As i said in my previous long winded post, I'm gonna try and make simple menu's that come up. EG: /cmds : opens a window that displays commands for me. Then I'll go onto 3DTextDraws and just work my way up until I'm a pawno star (like what i did there mick? Haha)
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Dobby

Edit for last message..could an admin add it to it for me? My phones awful -_- can't find an edit function, only a "moderate" button. Don't want to click it I don't know what it is.

I'll take a look at the wiki link tomorrow once i get back round my friends house
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Hobo

Pawno :D http://wiki.sa-mp.com/wiki/Category:Tutorials
That seems to be a good place to start learning. I suggest that you get familiar with (basic knowledge) of how scripting languages work. I started learning JavaScript and it seems to be fairly similar to Pawno. I've never scripted anything in pawno, but knowing the basic syntax helps you read what is going on in scripts that you download.
The other thing about downloaded scripts, different authors = different scripting styles. That can make you gamemode harder to understand. This is why scripting everything yourself, while time consuming, makes it a lot easier to read.

If you're just starting to learn Pawn, don't expect huge progress immediately. The SA-MP forums have many blank gamemode scripts that are formatted for you to start scripting them from scratch. I recommend that over just downloading other people's scripts.

Also, please make comments in your scripts. It will help you read what the hell you wrote. Trust me, use them.


[tr]
[td]

[/td]
[td][/td]
[td]

[shadow=black,left]My PC Specs:
-AMD Ryzen 7 2700X
-EVGA RTX 3080
-ASUS Prime X470-Pro Motherboard
-CORSAIR Vengeance RGB PRO 32GB RAM
-ADATA SX8200 NVME SSD 960GB
-Seagate IronWolf Pro 8TB HDD
-Western Digital Blue 2TB HDD
-ADATA Ultimate SU800 2TB SDD x2
-ADATA Ultimate SU800 1TB SSD x2
-Corsair HX750 Professional PSU
-NZXT H440 white/black case
[/shadow]
[/td]
[/tr]
[/table]

Matias

Quote from: The_Hobo on January 07, 2013, 22:43
Also, please make comments in your scripts. It will help you read what the hell you wrote. Trust me, use them.

Not like me. I fucked up a gamemode i was doing because i didnt use comments, i stopped for some months and when i got back to it i didnt understand anything  :biggrin:

You make comments doing them like this:


code; //Your comment here

Hobo

Quote from: Matias. on January 07, 2013, 22:46
Quote from: The_Hobo on January 07, 2013, 22:43
Also, please make comments in your scripts. It will help you read what the hell you wrote. Trust me, use them.
Not like me. I fucked up a gamemode i was doing because i didnt use comments, i stopped for some months and when i got back to it i didnt understand anything  :biggrin:
My point exactly. Use comments :D


[tr]
[td]

[/td]
[td][/td]
[td]

[shadow=black,left]My PC Specs:
-AMD Ryzen 7 2700X
-EVGA RTX 3080
-ASUS Prime X470-Pro Motherboard
-CORSAIR Vengeance RGB PRO 32GB RAM
-ADATA SX8200 NVME SSD 960GB
-Seagate IronWolf Pro 8TB HDD
-Western Digital Blue 2TB HDD
-ADATA Ultimate SU800 2TB SDD x2
-ADATA Ultimate SU800 1TB SSD x2
-Corsair HX750 Professional PSU
-NZXT H440 white/black case
[/shadow]
[/td]
[/tr]
[/table]

Dobby

I've worked out so far the basics like
"Public" should be blue
// makes green comment lines.
Correct me if I'm wrong but.. If you download a script from pastebin, a certain thing has to go on the right section, like
}
Public  OnGameModeInit
}

Sets a certain thing to show/happen when the gamemode loads :) i could be wrong as I stated above :)
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!

Matias

Quote from: DanielDawson on January 07, 2013, 22:59
I've worked out so far the basics like
"Public" should be blue
// makes green comment lines.
Correct me if I'm wrong but.. If you download a script from pastebin, a certain thing has to go on the right section, like
}
Public  OnGameModeInit
}

Sets a certain thing to show/happen when the gamemode loads :) i could be wrong as I stated above :)

Yes, if you copy something from pastebin just paste into a whole new pwn file without anything in it.
And at OnGameModeInit you gotta place script lines you want to execute when you launch your server, like timers, cars spawnpoints, players class, blah blah blah