arrow_upward

Posted by: PemburuHantu - 08-06-2019, 06:32 AM - Forum: Scripting & Programming - Replies (2)
Introduce
Hello!
I am new to this forum. I made a SAMP server script. My friend and I have created our server, and it turns out that the server is in great demand, because I haven't received a report that the server has a bug, so I decided to use my time helping people, who want to learn server scripts

Now in this tutorial I will create a [Login / Register] system, using Y_INI.


* What is Y_INI?
- [font=open_sansregular, Tahoma, Arial, sans-serif]Y_INI is a reader and writes data .INI or better known as '' FILE MANAGER SYSTEM '' Many SAMP users use Y_INI to create a LOGIN / REGISTER system
[/font]

* Developer of Y_INI  [font=arial, sans-serif]Alex "Y_Less" Cole[/font]


[font=open_sansregular, Tahoma, Arial, sans-serif]Tutorial[/font]
 

1. Add Y_INI include to the top of your script.
PHP Code:
#include <YSI/y_ini> 

2. Lets define the dialogs.
PHP Code:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4 

3. Lets define the Colors. You can found the color here https://htmlcolorcodes.com/
PHP Code:
#define COL_WHITE "{FFFFFF}
#define COL_RED "{FF0000}"
#define COL_BLUE "{0000FF}"
#define COL_GREEN "{00FF00}" 

4. Now define the 'Path' for .INI file.
PHP Code:
#define PATH "/Users/%s.ini" 

5. Now create enum, for store our variables.
PHP Code:
enum pInfo
{
 
   pPass,
 
   pCash,
 
   pAdmin,
 
   pKills,
 
   pDeaths
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 

6. Now create the function for load the player's data.
PHP Code:
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
 
   INI_Int("Password",PlayerInfo[playerid][pPass]);
 
   INI_Int("Cash",PlayerInfo[playerid][pCash]);
 
   INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
 
   INI_Int("Kills",PlayerInfo[playerid][pKills]);
 
   INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
 
   return 1;


7. Now create stock for UserPath. The stock function 'UserPath' is merely going to 'grab' the 'PATH' of the User's file.
PHP Code:
stock UserPath(playerid)
{
 
   new string[128],playername[MAX_PLAYER_NAME];
 
   GetPlayerName(playerid,playername,sizeof(playername));
 
   format(string,sizeof(string),PATH,playername);
 
   return string;




8. Add this code bellow your previous stock function. ( UserPath ) * The stock above is a simple 'hasher', and will be used to hash passwords, Credits to Dracoblue.
PHP Code:
stock udb_hash(buf[]) {
 
   new length=strlen(buf);
 
   new s1 1;
 
   new s2 0;
 
   new n;
 
   for (n=0n<lengthn++)
 
   {
 
      s1 = (s1 buf[n]) % 65521;
 
      s2 = (s2 s1    65521;
 
   }
 
   return (s2 << 16) + s1;


9. Now move to 'OnPlayerConnect' callback to check whether the player is register or not.
PHP Code:
public OnPlayerConnect(playerid)
{
 
   if(fexist(UserPath(playerid)))
 
   {
 
       INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
 
       ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
 
   }
 
   else
    
{
 
       ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
 
   }
 
   return 1;

[!] >> We'll be using the native 'fexist' function to search for our file. Parameters are set to our stock function which we've created. If the file exists, you will receive a 'Login' dialog. If it doesn't, you will receive a register dialog.


10. Now move to 'OnDialogResponse' for make dialog in register / login.
PHP Code:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
 
   switchdialogid )
 
   {
 
       case DIALOG_REGISTER:
 
       {
 
           if (!response) return Kick(playerid);
 
           if(response)
 
           {
 
               if(!strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
 
               new INI:File INI_Open(UserPath(playerid));
 
               INI_SetTag(File,"data");
 
               INI_WriteInt(File,"Password",udb_hash(inputtext));
 
               INI_WriteInt(File,"Cash",0);
 
               INI_WriteInt(File,"Admin",0);
 
               INI_WriteInt(File,"Kills",0);
 
               INI_WriteInt(File,"Deaths",0);
 
               INI_Close(File);

 
               SetSpawnInfo(playerid001958.331343.1215.36269.15000000);
 
               SpawnPlayer(playerid);
 
               ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
 
           }
 
       }

 
       case DIALOG_LOGIN:
 
       {
 
           if ( !response ) return Kick playerid );
 
           ifresponse )
 
           {
 
               if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
 
               {
 
                   INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
 
                   GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
 
                   ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
 
               }
 
               else
                
{
 
                   ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
 
               }
 
               return 1;
 
           }
 
       }
 
   }
 
   return 1;


[!] Instead of using the 'if' statement to define my dialogs, I've used cases as they seem to take less space and are supposedly 'faster'. The (!response) is the function if the first Button hasn't been clicked, it will then kick the player. 

The if(!strlen(inputtext)) explains if nothing has been entered into the dialog (input), you would then be prompted to another dialog which shows you 'Incorrect Password'.

If all goes well, the function INI_Open is then 'executed' which loads and opens the Userfile. Once open, the function 'INI_WriteInt' is then called and starts writing the data into the userfile. The udb_hash would generate a hash code from the player's inputtext (what you've typed). And after all this is completed, it is then closed by 'INI_Close' function.

Once finished, you will then be prompted to the 'Login' dialog.



In 'DIALOG_LOGIN', if the response is false (you have clicked 'QUIT), you would then be kicked. If given the correct information (password provided), the INI_Parsefile function would then scan and load your player's data.


11. Don't forget, you would need a way to save those variables. The OnPlayerDisconnect callback simply re-opens the files, write what-ever values which has been stored and then closes it.
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
 
   new INI:File INI_Open(UserPath(playerid));
 
   INI_SetTag(File,"data");
 
   INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
 
   INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
 
   INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
 
   INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
 
   INI_Close(File);
 
   return 1;


12. Finally, add this to OnPlayerDeath to add value(s) to kills and deaths.
PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
 
   PlayerInfo[killerid][pKills]++;
 
   PlayerInfo[playerid][pDeaths]++;
 
   return 1;

[font=open_sansregular, Tahoma, Arial, sans-serif]Download[/font]
[font=open_sansregular, Tahoma, Arial, sans-serif]Y_INI https://github.com/Southclaws/YSI-4.0/bl.../y_ini.inc[/font]
[font=open_sansregular, Tahoma, Arial, sans-serif][font=open_sansregular, Tahoma, Arial, sans-serif][font=open_sansregular, Tahoma, Arial, sans-serif]Credits[/font][/font][/font]
[font=open_sansregular, Tahoma, Arial, sans-serif][font=open_sansregular, Tahoma, Arial, sans-serif][font=open_sansregular, Tahoma, Arial, sans-serif]Y-Less for 'Y_INI'[/font][/font][/font]
Posted by: Sn1F3rt - 08-05-2019, 12:02 PM - Forum: Tutorials - Replies (7)
Hi guys,

The default port for VestaCP is 8083. In this tutorial, I shall be showing you how to change it.
  1. Log into your Vesta Control Panel.
  2. Click on Firewall on Your Vesta menu
  3. Click on the Green Plus button to add the New Port
  4. I will be changing my port to 2019.  For the new port, add the details as follows:

    Code:
    Action:  ACCEPT

    Protocol: TCP

    Port: 2019

    IP Address: 0.0.0.0/0

    Then click Add, to add the new port to your Firewall.
  5. Next edit the NGINX config file to listen to the new port, in my case 2019.
  6. To do this, login into your SSH client. Make sure you are the root user or a user with root (sudo) privileges.
  7. Issue the following command:
    Code:
    sudo vi /usr/local/vesta/nginx/conf/nginx.conf


  8. Press the INSERT key.
  9. Scroll down to the area which says:
    Code:
    listen 8083;


  10. And change it to:
    Code:
    listen 2019;


  11. Then exit out of the editor by pressing Esc key and then type :wq and press Enter.
  12. Then restart Vesta using the Command below.
    Code:
    sudo service vesta restart


  13. Now log into your VestaCP using the new port as follows.
    Code:
    Your-IP-Address:2019


  14. Finally, you may delete the old port, 8083.

    To delete the port 8083 from your Firewall, just click on Firewall on your Top Menu within Vesta.

    Then hover over port 8083 and delete it.
That’s how to replace port 8083 on VestaCP. Hope you guys enjoyed the tutorial.

Regards,
Posted by: Hnewbie - 08-05-2019, 09:57 AM - Forum: Hardware & Technology - Replies (2)
Eucledion introduced a better and efficient way of graphics processing 2-3 years ago in which the computer runs at the same speed no matter how realistic the graphics are.It uses particles to create models instead of using polygons that are made out vertices.I also solves the 3D world detailing problem (s) in VR.
I saw some people and companies offending this method.Also i have a bit of doubt that its not real because a computer has to process alot of objects(particles) which requires more memory.
Just want to know your opinion about this and how it really works (if it does).
Posted by: Champion - 08-05-2019, 01:49 AM - Forum: Scripting & Programming - No Replies
I want to know from where should I start because in my country courses are very expensive and if there is a website somewhere on internet could help me that would be good as I want to learn illustration.
Posted by: Champion - 08-05-2019, 01:42 AM - Forum: General Gaming Discussion - Replies (19)
For me the best games I ever played:
-Gta V
-Far Cry 3
-SAMP
What about you?
Posted by: hamed - 08-04-2019, 08:45 PM - Forum: Make Money - Replies (5)
hey guys . I've found a community like this that you can make money from. You can get cash from paypal as well as from bitcoin.
These are the two ways the community admin will pay you.
The community is crowded and has a lot of advertising. I suggest you if you need bitcoin you can get this site for free.
Community Address: https://www.beermoneyforum.com
Posted by: hamed - 08-04-2019, 07:13 PM - Forum: VPS Support - Replies (6)
hey guys . in list vps 1 have vswap ram but my vps dont have . If vps 1 have vswap please enable it for my vps . i need more ram for my vps :Sadty
link ; https://post4vps.com/compare/#1,3,6,7,8,...4,15,17,18
Posted by: Manal - 08-04-2019, 11:48 AM - Forum: Value VPS Providers - No Replies
[Image: logo_c.png]

Shadow Hosting | Presents you DDoS Protected KVM VPS Server
Are you running a gameserver? But your rivals won't let you and your players play in your server peacefully by launching attacks? We've got the solution for your issue! Shadow Hosting International brings you KVM powered VPS server best for your gaming community where almost all types of DDoS attacks are filtered in less than a second with no downtime. 

Support -  
One of the best things you'd experience with us is support. Our support team is always ready to help you out in any issue you face within the server. We will help you out with any issue you find in our service and fix it. In case of downtime, we'd compensate you accordingly with double the period of downtime. Read SLA policy.

Security -
Our infrastructure is protected by double security layers. With nodes and other accessories that keep our service alive is secured behind multiple layers of protection against cyber-attack. In the case of a DDoS attack, our mitigation system automatically vacuums the malicious traffic into the mitigation system and only legitimate traffic is allowed to pass.

Affordable -
All our services are affordable and at a reasonable price. With our support and features we'd provide, we'd say the price for which we sell our service is kind-of too low but, guess what? Our customer's satisfaction is what matters us the most.

Plans -
1)
Intel® Xeon® CPU D-1521
1 Core
2.40GHz
2 GB RAM
90 GB HDD
[Image: gb.png] UK Location
$7/month

2)
Intel® Xeon® CPU D-1521
2 Core
2.40GHz
4 GB RAM
180 GB HDD
[Image: gb.png] UK Location
$14/month

Contact Us -
Email - [email protected]
Phone Number - +918291064208 (India only).
Pre-Sales Ticket Support - https://shadowhosting.net/billing/contact.php
Live Chat - https://tawk.to/chat/5b73ef56f31d0f771d83cee2/default
Facebook - https://www.facebook.com/shadownetworksinternational
Twitter - https://twitter.com/shadowhostint
Posted by: deanhills - 08-04-2019, 03:28 AM - Forum: Internet Technology - Replies (12)
This thread was inspired by the announcement from HostLease about the EU requirement for ID. Although I have a perfect understanding where that comes from, and I know Hostlease has to do it, it still makes me hot under the collar at the way things are moving with the Internet. We no longer have the freedom we used to have. And it's steadily getting worse and worse.

We've just had a major successful hacking of a very large credit card corporation - Capital One - in Canada last week. It involved millions of ID including social insurance numbers. The hacking was done by a crazy IT lady from the States who said she did it just because she could. She announced it in the social media and is now behind bars. That to me means there must have been a vulnerability in Capital One's access system for a crazy person to have been able to hack it. Luckily it doesn't look as though the info was sold, BUT, wow. Where is this going to stop? Like small people like us get to be shunted around by large corporations and governments to trust them with our personal details. These days every one is living with plastic IDs and credit and debit cards that are provided as though that is regular and OK to do. If one questions it, one is seen as "otherwise". I'm otherwise! I don't think the banking or any of the other corporations and governments care one iota about my safety and security. It's all about control for their own agendas and it always ends up with their bottom line. It's cheap to do it this way. And if a large corporation or Government entity gets hacked, maybe that's good for them, as they now have an added excuse to put in more safety and controls, and demand more ID and compliance from every one else. All in the name of safety and security. For me the EU in Europe is a glorified police state. Thank goodness I'm not living there! But I don't think it is farfetched to think that what is happening in Europe is probably going to make its way to the rest of the world as Governments in other countries must be watching what the EU is doing with the Internet ID requirement. WordPress, a US company has even all of the EU docs prepared in new WordPress installations.

The dark net now seems to be looking attractive to me. Where does one start with it? Like can someone really savvy create a "safe zone" in the dark net where Governments and large corporations can't get their greedy fingers in? Confused
Posted by: Sn1F3rt - 08-02-2019, 11:58 AM - Forum: Web Design & Projects - Replies (15)
Hi guys,

I've made this post out of curiosity to know which method do you all prefer to redirect HTTP traffic to HTTPS. There are two solutions possible:

  1. Plugins(like Really Simple SSL)
  2. .htaccess file redirect
Plugins like Really Simple SSL(and there are lots out there...) make it really easy for users to the HTTPS redirect. This is especially suggested for newbies who aren't much-aquainted to programming files themselves. It provides a really simple interface for users to do what they intend in the click of a button. However, This has a flip side too. That is, only the WordPress site gets redirected. Other direct access images or files remain open on HTTP port.

The next method - the .htaccess file method -  is my personal favorite. This is because it redirects all requests on HTTP to HTTPS. There isn't much to understand. I will be providing the code. Just copy and paste this on top of all contents in your .htaccess file in your WP directory.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]
</IfModule>

And you shall start realizing the magic. Feel free to post your opinion too - I am very eager to hear them Also created a poll so that you can vote for your preferred method. Cheers!

Regards,
Pages (306): Jump to page 
Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 2,271
» Latest member: orzpainter
» Forum threads: 3,100
» Forum posts: 34,783

Full Statistics

Online Users
There are currently 297 online users.
» 0 Member(s) | 293 Guest(s)
Yandex, Bing, Applebot, Google

Latest Threads
⚡ EnjoyVPS.Com : 35+ Glob...
Forum: Others
Last Post: RIYAD
01-06-2026, 01:21 AM
» Replies: 0
» Views: 586
Get LLHOST Netherlands Fe...
Forum: Others
Last Post: LLHOST
09-29-2025, 03:02 AM
» Replies: 0
» Views: 988
Super Fast LLHOST Netherl...
Forum: Value VPS Providers
Last Post: LLHOST
09-16-2025, 05:01 AM
» Replies: 0
» Views: 700
Get LLHOST Netherlands Fe...
Forum: Cheap Providers
Last Post: LLHOST
09-08-2025, 01:33 PM
» Replies: 0
» Views: 830
Windows VPS @ $31.5/Year ...
Forum: Cheap Providers
Last Post: DewlanceHosting
08-16-2025, 03:12 AM
» Replies: 0
» Views: 958
Buy DemoTiger Videos on c...
Forum: Others
Last Post: DewlanceHosting
08-16-2025, 03:10 AM
» Replies: 8
» Views: 6,548
Budget Dedicated Servers ...
Forum: Others
Last Post: HostNamaste
08-13-2025, 04:54 AM
» Replies: 2
» Views: 1,990
☁️ How to Use VCCPRO Virt...
Forum: Cheap Providers
Last Post: bestadvisor
07-13-2025, 09:36 AM
» Replies: 0
» Views: 1,429
[Promo] 30% Discount – VP...
Forum: Cheap Providers
Last Post: LLHOST
07-11-2025, 12:56 PM
» Replies: 0
» Views: 1,011
✅ Affordable VPS Hosting ...
Forum: Cheap VPS Providers
Last Post: RIYAD
07-02-2025, 03:02 AM
» Replies: 0
» Views: 2,266

Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting