script help
#1

i need help conveting these's code's to dcmd

1.login.....

Код:
  new cmd[256];
  new idx;
  cmd = strtok(cmdtext, idx);
  	new tmp[256];
  new playername[MAX_PLAYER_NAME];
  new string[256];
  new moneys;
  new giveplayer[MAX_PLAYER_NAME];
  new giveplayerid;
  {
 if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerInfo[playerid][PLAYER_LOGGED] == 1)
			{
				SendClientMessage(playerid, COLOUR_ORANGE, "	You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOUR_ORANGE, "	USAGE: /login [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
		}
		}

2....onplayerlogin

i need someone to help me with this coz for some reson i keep fucking it up

3...register

Код:
if (strcmp(cmd, "/register", true)==0)
	{
		//new string[265];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]");
			return 1;
		}
		if (gPlayerAccount[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
			return 1;
		}

		strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
		Encrypt(PlayerInfo[playerid][pPassword]);
		GetPlayerName(playerid, playername, sizeof(playername));
		format(string, sizeof(string), "%s.cer", playername);
		new File: file = fopen(string, io_read);
		if (file)
		{
			SendClientMessage(playerid, COLOR_GREY, "  That name is already registered");
			fclose(file);
			return 1;
		}
		new File:hFile;
		hFile = fopen(string, io_append);
		new var[32];//
    format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
    format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
    format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
    format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var);
		fclose(hFile);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}


ok so the first one i dont know what to do coz of the cmdtext

and for the 3erd one i dont know what to do


thx for ur time
Reply
#2

https://sampwiki.blast.hk/wiki/Creating_...n_FilterScript

It shows you how to make /register + /login + saving data to files with dcmd
Reply
#3

.... OMG!!!!!!!!!! i whent there and it wont save my data i go in register i go out i go back in and it dosent allow me to login unless i register again so if you could fix that that would be great
Reply
#4

.... OMG!!!!!!!!!! UDDDEUDE!!
Please, type properly. I can't understand half the stuff you're saying.
Reply
#5

im just saying that the script dont work so if you can fix it that would be good
Reply
#6

ok i needs some help here im still stuck and iv added commands so idk if that changes anything but still ... HELP!
Reply
#7

Quote:
Originally Posted by SA-MP Wiki
Change these to suit your server, but you will need to have these folders inside your server location's 'scriptfiles' folder:

Код:
"AdminScript/Users"
"AdminScript/Settings"
If you don't do that, your server will crash, and that would be bad, so I recommend leaving them as they are, and creating the folders now.
Did you do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)