Login Script
#1

Hello and good night everyone!

today I downloaded a bunch of gamemodes to get to know where to start.
im pretty new to pawn, but have some knowledge in other languages.

in a gamemode called LSL:RP i found a pretty cool login function:
[img width=960 height=768]http://i50.tinypic.com/s0zyfa.png[/img]

Could someone describe to me how thats done? or at least put me in the right direction?

Also

i want to know if its possible to use an other form for money without mysql (flatfiles)?
i want my own cash on my server cause i find the regular cash in game pretty bugged, and most anticheats have walk arounds for money

Thx !



Reply
#2

Server-sided cash

Top of script:

Код:
new Cash[MAX_PLAYERS];
Bottom of script:

Код:
stock GetPlayerCash(playerid)
{
return Cash[playerid]
}
stock GivePlayerCash(playerid,cash)
{
Cash[playerid] = Cash[playerid] + cash;
return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
Cash[playerid] = 0;
return Cash[playerid];
}
Login/Register

OnPlayerConnect:

Код:
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"/Accounts/%s.ini",name);
if(fexist(string))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome!\nPlease login","Login","Exit");
}
if(!fexist(string))
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register","Welcome!\nPlease register","Register","Exit");
}
Under #include <a_samp>:

Код:
#include <file>
You figure out the rest. Good luck on your very new server.

Off topic: You play Spring-Vale? Cuz you're name is Camel there and i see "Camel" in game right now and you're asking questions about the features spring-vale has so i'm just connecting the dots..
Reply
#3

It doesnt works good.
The [MAX_PLAYERS] is undefined symbol

And also when you join the server it requests only register
You should make OnDialogResponse
Reply
#4

Will the file and fexist work for all login/register systems?
Reply
#5

Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Will the file and fexist work for all login/register systems?
What do you mean?

fexist(file[]) just checks if the file (file[]) exists.
It's not specific to certain register/login systems.
Reply
#6

Just checks if the file exists ?
Reply
#7

Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Just checks if the file exists ?
Yes, that's all the function does.

https://sampwiki.blast.hk/wiki/fexist
Reply
#8

Alright thanks
Reply
#9

Thx ill try it out! and yes ^^ i play SV Camel[Toe] -> [Toe] clan x) Sv ftw ^^
Reply
#10

Quote:
Originally Posted by Coole[AG
]
You figure out the rest. Good luck on your very new server.
Works flawless, ill get to the figure out the rest part now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)