Save player name (?)
#1

How can I create a command to save the name of a player on the server, so when I type /team appeared the name of the player that I put there?
I would also like a command to delete the name of the player of the team .. thanks to those who help me
I'm trying to create one from scratch GameMode .. thanks
Reply
#2

You can do it with dini. Read this Tutorial(Click). Just create a file called, e.g. Team1.ini and save the names in it.
Reply
#3

Quote:
Originally Posted by DeathOnaStick
You can do it with dini. Read this Tutorial(Click). Just create a file called, e.g. Team1.ini and save the names in it.
Very thanks (L)



Код:
new cmd[256], idx, file[128], tmp[256], tmp2[256];
  cmd = strtok(cmdtext, idx);
  if(strcmp(cmd, "/teaminfo", true) == 0)
	{
	  new PlayerName[24];
	  tmp = strtok(cmdtext, idx);
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /teaminfo [password]");
		new name[MAX_PLAYER_NAME];
		if(IsLogged[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR, "You already are logged in!");
			return 1;
		}
		else
		{
			GetPlayerName(playerid, name, sizeof(name));
			format(file,sizeof(file),"%s.ini",name);
			if(fexist(file))
			{
		  	tmp2 = dini_Get(file, "Password");
			 	if(udb_hash(tmp) != strval(tmp2))
				{
				  SendClientMessage(playerid, COLOR, "Login Failed!");
	 			  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	 			  printf("%s has failed to login", name);
				}
				else
				{
				 	IsLogged[playerid] = 1;
				 	SetPlayerMoney(playerid, dini_Int(file, "Cash"));
					PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
					SendClientMessage(playerid, COLOR, "[System]: Account Logged into!");
				}
			}
		}
		return 1;
	}
  if(strcmp(cmd, "/inviteteam", true) == 0)
	{
	  new name[MAX_PLAYER_NAME];
	  tmp = strtok(cmdtext, idx);
	  GetPlayerName(playerid, name, sizeof(name));
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /convidarteam [password]");
	  format(file,sizeof(file),"%s.ini",name);
	  if(!fexist(file))
			{
			  dini_Create(file);
			  dini_IntSet(file, "Team1", udb_hash(tmp));
			  dini_IntSet(file,"Team2", 0);
			  dini_IntSet(file,"Team3", 0);
			  SendClientMessage(playerid, eadmin, "[System]: Team created!");
			  PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
			  GetPlayerName(playerid, name, sizeof(name));
			  printf("%s has registered a account!", name);
			}
			else
			{
			  SendClientMessage(playerid, COLOR, " Account Already Found In Database");
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
			}
		return 1;
	}
	return 0;
}





Now I do not know what to do!
Could anyone give me an example of a command of only 1?
pInfo
team1
?
Reply
#4

bump
Reply
#5

Using dini_Set,he set string in file..
LoL BUMP *-*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)