Jump to content
  • 0

pomoc HELP


arci224

Dotaz

Dělám si admins na verci 0.3.7 ale mám jaksi problém:

CMD:admins(playerid,params[])
{
	new count = 0;
	new string[254];
	new fstring[512];
	new ARank[254];
	for(new i = 0; i < MAX_PLAYERS; i++){
		if (IsPlayerConnected(i)){
			if(PlayerInfo[i][pAdmin] > 0){
				count++;
				switch(PlayerInfo[i][pPrace]){
					case 1: {pPrace = "Hraje";} // zde chyba
					case 2: {pPrace = "Afkuje";} // zde chyba
					case 3: {pPrace = "Pracuje";} // zde chyba
				}
				if(IsPlayerAdmin(i))
				{
					ARank = "Rcon Administrátor";
				}else{
				switch(PlayerInfo[i][pAdmin]){
					case 1: {ARank = "Moderator";}
					case 2: {ARank = "Začátečnický administrátor";}
					case 3: {ARank = "Pokročilý Administrátor";}
					case 4: {ARank = "Skušený administrátor";}
					case 5: {ARank = "Administrátor";}
					case 6: {ARank = "Pawner / Mapper";}
				}
			}
		}
	}
	format(fstring, sizeof(fstring), " Hodnost \t Méno \t Co dělá \n {6EF83C} %s \t %s \t %s\n", ARank, GetPlayerName(i), pPrace); // zde 2x warningy
	strcat(string, fstring);
	}
	if (count == 0) return ShowPlayerDialog(playerid, 120, DIALOG_STYLE_MSGBOX, "{6EF83C}Online Admins", "{FFFFFF}Žadný administrátor není na serveru.", "Ok","");
	else{
		format(fstring, sizeof(fstring), "\r\n{6EF83C}Admins: {FFFFFF}%d", count);
		strcat(string, fstring);
		ShowPlayerDialog(playerid, 120, DIALOG_STYLE_TABLIST_HEADERS, "{6EF83C}Online Admins", string, "Ok", "");
	}
return 1;
}
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(925) : error 022: must be lvalue (non-constant)
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(925) : warning 215: expression has no effect
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(926) : error 022: must be lvalue (non-constant)
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(926) : warning 215: expression has no effect
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(927) : error 022: must be lvalue (non-constant)
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(927) : warning 215: expression has no effect
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(944) : warning 202: number of arguments does not match definition
C:\Users\ASUS\Desktop\Honza Cool Videa a slozky\servery\0.3.7 1\gamemodes\test.pwn(944) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
 
 
3 Errors.
 
Prosím pomožte
Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0

pPrace nemáš jako string.

Zkus udělat to, že si vytvoříš další proměnnou, např. strPrace[20].

Poté do ní ukládej to, co potřebuješ.

 

case 1: { strPrace = "Hraje"; }
case 2: { strPrace = "Afkuje"; }
case 3: { strPrace = "Pracuje"; }

Ty warningy na řádku 944:
Můžeš si kamkoliv do módu dát stock:

stock PlayerName(id)
{
 new n[MAX_PLAYER_NAME];
 GetPlayerName(id, n, MAX_PLAYER_NAME);
 return n;
}

a poté místo GetPlayerName(i) použít PlayerName(i) a nebo si vytvořit proměnnou pName[MAX_PLAYER_NAME]; a poté nahradit GetPlayerName(i) tímto:

GetPlayerName(i, pName, MAX_PLAYER_NAME)
Edited by SeaS
Link to comment
Share on other sites

  • 0

Taková drobná gramatická chyba - nedělá to dobrý dojem ,proto doporučuji opravit si

case 4: {ARank = "Skušený administrátor";}

na

case 4: {ARank = "Zkušený administrátor";}

:):d

Link to comment
Share on other sites

  • 0

~> Proč by musel zakládat zbytečně další, když furt může používat tu samou?

 

~> Nezapomeň na naše znaménko \0 jinak chudák s nejdelším nickem přijde o písmenko:

 

new n[MAX_PLAYER_NAME+1];
GetPlayerName(id, n, sizeof(n));
~> K autorovi: Máš to zbytečně zdlouhavé, složité a sotva přehledné. Co takhle menší úpravu na profesionálnější úrovni?:

 

 

 

PlayerNick(playerid) {
	new
	    Nick[MAX_PLAYER_NAME+1];
	GetPlayerName(playerid, Nick, sizeof(Nick));
	return Nick;
}

new
	pPrace[4][] = {
	"-nic", "Hraje", "Afkuje", "Pracuje"
};

new
	aHodnosti[8][] = {
	"-nic-"
	"Moderator", "Začátečnický administrátor",
	"Pokročilý Administrátor", "Skušený administrátor",
	"Administrátor", "Pawner / Mapper", "Rcon Administrátor"
};

CMD:admins(playerid,params[])
{
	new 
		String[1500],
		bool: IsOnline;
	for(new i, j = GetPlayerPoolSize(); i <= j; i++) {
		if (IsPlayerConnected(i)) {
		
			if(PlayerInfo[i][pAdmin] > 0) {
				if(IsPlayerAdmin(i)) {
				
					format(String, sizeof(String), "%s\nHodnost \t Méno \t Co dělá \n {6EF83C} %s \t %s \t %s\n",
						String, aHodnosti[7], PlayerNick(i), pPrace[PlayerInfo[i][pPrace]]);
					IsOnline = true;
				}else{
				
					format(String, sizeof(String), "%s\nHodnost \t Méno \t Co dělá \n {6EF83C} %s \t %s \t %s\n",
						String, aHodnosti[PlayerInfo[i][pAdmin]], PlayerNick(i), pPrace[PlayerInfo[i][pPrace]]);
                	IsOnline = true;
				}
			}
		}
	}
	if (!IsOnline) return ShowPlayerDialog(playerid, 120, DIALOG_STYLE_MSGBOX, "{6EF83C}Online Admins", "{FFFFFF}Žadný administrátor není na serveru.", "Ok","");
	ShowPlayerDialog(playerid, 120, DIALOG_STYLE_TABLIST_HEADERS, "{6EF83C}Online Admins", string, "Ok", "");
	return 1;
}

 

Z tvého códu který sem si vložil do pawna, se my to nechce scompilovat nevěděl bys proč ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...