[pomoc] oko davanje admin/gm

Započeo El Toni, April 15, 2012, 17:18:24 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

Skripta koju koristim: GF (DT)
Detaljan opis problema:  jel mogu ikako napravit kad dajem na nekome admin / gm da se to upise u scriptfiles tamu da napravim file admin i kad dajem da upise admin ... dao admin .... razumjete kao sto kad banujem nekoj dodze sve to u script files....jel moze da se napravi tako i kad dajem admin/gm?
Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno):

ovo dodaj na kraj scripte:

stock MALog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeAdminLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao admina igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}


e sad neznam kako ti ide komanda za davanje admina al recimo da je igrac kome se daje admin 'id' a igrac koji daje admina 'playerid', i da je varijabla za level 'level'...

dodas ovo na kraj komande:

new plname[MAX_PLAYER_NAME], idname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
GetPlayerName(id, idname, sizeof(idname));
MALog(plname, idname, level);


ako ti nije jasno daj komandu da ti ubacim, isto radis i za gma ;) samo novi stock i to..

Citat: dock poslato April 15, 2012, 17:25:50 POSLE PODNE
ovo dodaj na kraj scripte:

stock MALog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeAdminLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao admina igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}


e sad neznam kako ti ide komanda za davanje admina al recimo da je igrac kome se daje admin 'id' a igrac koji daje admina 'playerid', i da je varijabla za level 'level'...

dodas ovo na kraj komande:

new plname[MAX_PLAYER_NAME], idname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
GetPlayerName(id, idname, sizeof(idname));
MALog(plname, idname, level);


ako ti nije jasno daj komandu da ti ubacim, isto radis i za gma ;) samo novi stock i to..
pa..nie mi bas jasno evo komande..

Admin
if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORISTI: /makeadmin [playerid/PartOfName] [level(1-1338)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pAdmin] = level;
						printf("AdmCmd: %s go promovira %s vo level %d admin.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d admin.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}

GameMaster
if(strcmp(cmd, "/makegm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makemaster [playerid/PartOfName] [level(1-4)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(level > 3 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 3!"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pGameMaster] = level;
						printf("AdmCmd: %s go promovira %s vo level %d GameMaster.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d GameMaster.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}

na kraj moda dodaj ovo:

stock MALog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeAdminLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao admina igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}

stock MGMLog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeGMLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao GMa igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}


makeadmin komanda:

if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORISTI: /makeadmin [playerid/PartOfName] [level(1-1338)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pAdmin] = level;
						printf("AdmCmd: %s go promovira %s vo level %d admin.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d admin.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						MALog(sendername, giveplayer, level);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}


i makegm komanda..

if(strcmp(cmd, "/makegm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makemaster [playerid/PartOfName] [level(1-4)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(level > 3 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 3!"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pGameMaster] = level;
						printf("AdmCmd: %s go promovira %s vo level %d GameMaster.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d GameMaster.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						MGMLog(sendername, giveplayer, level);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}

Citat: dock poslato April 15, 2012, 17:31:10 POSLE PODNE
na kraj moda dodaj ovo:

stock MALog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeAdminLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao admina igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}

stock MGMLog(name[MAX_PLAYER_NAME],primaoc[MAX_PLAYER_NAME], level)
{
	new Godina, Mesec, Dan;
	getdate(Godina, Mesec, Dan);
	new Sati, Minuta, Sekundi;
	gettime(Sati, Minuta, Sekundi);

	new stringe[256];
	new File:file,str[256];
	format(stringe,256,"MakeGMLog.txt");
	file=fopen(stringe,io_append);
	format(str, 256, "[%02d/%02d/%02d - %02d:%02d:%02d] *%s je dao GMa igracu %s | LEVEL ADMINA: %d | \n", Dan, Mesec, Godina, Sati, Minuta, Sekundi ,name,primaoc,level);
	fwrite(file,str);
	fwrite(file,"\n");
	fclose(file);
}


makeadmin komanda:

if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "KORISTI: /makeadmin [playerid/PartOfName] [level(1-1338)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pAdmin] = level;
						printf("AdmCmd: %s go promovira %s vo level %d admin.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d admin.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						MALog(sendername, giveplayer, level);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}


i makegm komanda..

if(strcmp(cmd, "/makegm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makemaster [playerid/PartOfName] [level(1-4)]");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(level > 3 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 3!"); return 1; }
			if (PlayerInfo[playerid][pAdmin] >= 1338)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pGameMaster] = level;
						printf("AdmCmd: %s go promovira %s vo level %d GameMaster.", sendername, giveplayer, level);
						format(string, sizeof(string), "   Promovirani ste vo level %d od administrator %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   Promovirani ste od %s vo level %d GameMaster.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						MGMLog(sendername, giveplayer, level);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   Ne ste ovlasteni za ova komanda!");
			}
		}
		return 1;
	}

sredzeno...hvala puno brate