#1

Just wondering how I would make a /Creategang command that saves. Like /Creategang [name][color]. This is for Pen1.
So far Ive got
Код:
if (strcmp(cmd, "/CreateGang", true) ==
  {
    new gangid;
    tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  /CreateGang [name][color]");
			return 1;
		}
		if (gPlayerLogged[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  You need to login to create a Gang");
      return 1;
    }
    	new gangName[256];
    	GetGangName(gangid);
		format(string, sizeof(string),"%s.Gang",gangName);
	  if (fexist(string))
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  That Gang aready exists");
			return 1;
		}
		GetGangName(gangid);
    new var[32];//
		format(string, sizeof(string), "%s.Gang", gangName);
		new File: file = fopen(string, io_read);
		if (file)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "  That Gang already exists");
			fclose(file);
			return 1;
		}
    GetPlayerName(playerid, playername, sizeof(playername));
		new File:hFile;
		hFile = fopen(string, io_append);
		format(var, 32, "%d gColor\n", GangInfo[gColor]);fwrite(hFile, var);
	  format(var, 32, "%s gLeader\n", GangInfo[gLeader]);fwrite(hFile, var);
		format(var, 32, "%s gMembers\n", GangInfo[gMembers]);fwrite(hFile, var);
		fclose(hFile);
	  return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)