Help - Nume player sub mini-map
#1

Salutare,

1.Am incercat sa fac si eu un textdraw cu numele jucatorului sub mini-map, insa mi-a dat o eroare de care am scapat destul de greu. As dori foarte mult, daca se poate, un [Fs] in care sa fie inclus totul ( new, textdraw, etc). As ramane vesnic indatorat !

2. As avea nevoie de comanda /newbie si /rac, le caut de foarte mult timp, si nu am gasit nimic bun pana acum.

Multumesc !
Reply
#2

Comanda /RAC SAU /respawnallcar
Code:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] <= 1337)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
			    return 1;
			}
			new bool:unwanted[CAR_AMOUNT];
			for(new player=0; player<MAX_PLAYERS; player++)
     		{
            	if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
     		}
			for(new car = 1; car <= 268; car++)
			{
				if(!unwanted[car]) SetVehicleToRespawn(car);
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "AdmCmd: %s a respawnat toate masinile de pe server", sendername);
			SendClientMessageToAll(COLOR_RED,string);
		}
		return 1;
	}
Iar pentru numele sub minimap faci in felul urmator:

1. Creeam linia :
Code:
new Text:Nume[MAX_PLAYERS];
2. Cauta in GM [Ctrl+F] linia :
Code:
//OnPlayerConnect
Dam putin mai jos gasim linia format(string, sizeof(string), "%s.ini", plname); si sub ea punem acest cod:

Code:
//-------------------------------------------
new pnamee[24];
GetPlayerName(playerid, pnamee, sizeof(pnamee));
Nume[playerid]= TextDrawCreate(28.000000,428.000000,pnamee);
TextDrawAlignment(Nume[playerid],0);
TextDrawBackgroundColor(Nume[playerid],0xffffffff);
TextDrawFont(Nume[playerid],1);
TextDrawLetterSize(Nume[playerid],0.799999,1.200000);
TextDrawColor(Nume[playerid],0x00ff0033);
TextDrawSetOutline(Nume[playerid],1);
TextDrawSetProportional(Nume[playerid],1);
TextDrawSetShadow(Nume[playerid],1);
TextDrawShowForPlayer(playerid,Nume[playerid]);
//-------------------------------------------
3. Cautam in GM[Ctrl+F] linia :
Code:
//OnPlayerDisconnect
Punem dupa ea :
Code:
TextDrawDestroy(Nume[playerid]);
Reply
#3

Tot ce tine de /newbie
Code:
	if(strcmp(cmd, "/clearnewbie", true) == 0 || strcmp(cmd, "/clearn", true) == 0)
 	{
     	if(IsPlayerConnected(playerid))
     	{
     		if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
      		{
       		SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
       		return 1;
        	}
        	SendClientMessageToAll(COLOR_GRAD2, "USAGE: Newbie chat has been cleared");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
       	 	format(string, sizeof(string), "                                             ");
        	SendNewbieMessage(0x25DA53FF, string);
		}
		return 1;
	}
	if(strcmp(cmd, "/mutenew", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /mutenew(bie) [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
					    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						Nmute[giveplayerid] = 1;
						printf("AdmCmd: %s muted %s in the newbie chat",sendername,  giveplayer);
						format(string, sizeof(string), "AdmCmd: %s was muted in newbie chat by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "  That player is offline.");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/unmutenew", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /unmutenew(bie) [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
					    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						Nmute[giveplayerid] = 0;
						printf("AdmCmd: %s unmuted %s in the newbie chat",sendername,  giveplayer);
						format(string, sizeof(string), "AdmCmd: %s was unmuted in newbie chat by %s",giveplayer ,sendername);
						ABroadCast(COLOR_LIGHTRED,string,1);
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "  That player is offline.");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}
	if(strcmp(cmd, "/newbieoff", true) == 0)
 	{
     	if(IsPlayerConnected(playerid))
     	{
     		if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
      		{
       		SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
       		return 1;
        	}
        	new length = strlen(cmdtext);
        	while ((idx < length) && (cmdtext[idx] <= ' '))
        	{
        	idx++;
        	}
        	new offset = idx;
        	new result[128];
        	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        	{
        	result[idx - offset] = cmdtext[idx];
        	idx++;
        	}
        	result[idx - offset] = EOS;
        	if(!strlen(result))
        	{
        	SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/newbieoff) [reason]");
        	return 1;
        	}
        	NewBie[playerid] = 0;
        	SendClientMessage(playerid, COLOR_GRAD2, "USAGE: Newbie chat has been turned off");
		}
		return 1;
	}
	if(strcmp(cmd, "/newbieon", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(PlayerInfo[playerid][pHelper] < 1 && PlayerInfo[playerid][pAdmin] < 1)
			{
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "You are not a helper/admin!");
			return 1;
			}
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
			idx++;
			}
			new offset = idx;
			new result[128];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
			result[idx - offset] = cmdtext[idx];
			idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/newbieon) [reason]");
			return 1;
			}
			NewBie[playerid] = 1;
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: Newbie chat has been turned on");
		}
		return 1;
	}
		if(strcmp(cmd, "/nonewbie", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (PlayerInfo[playerid][pAdmin] >= 1 && (!nonewbie))
			{
				nonewbie = 1;
				BroadCast(COLOR_GRAD2, "   Newbie chat channel disabled by an Admin!");
			}
			else if (PlayerInfo[playerid][pAdmin] >= 1 && (nonewbie))
			{
				nonewbie = 0;
				BroadCast(COLOR_GRAD2, "   Newbie chat channel enabled by an Admin!");
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You do not have admin access, denied to use the command.");
			}
		}
		return 1;
	}
   	if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet!");
	            return 1;
	        }
	        if(PlayerInfo[playerid][pLevel] < 4 || PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >=1)
            { }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Nu mai esti newbie, levelul tau este deja mare. ");
                return 1;
            }
			if ((nonewbie) && PlayerInfo[playerid][pAdmin] < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "The Newbie channel has been disabled by an admin!");
				return 1;
			}
			if(PlayerInfo[playerid][pNMuted] == 1)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak in Newbie channel");
				return 1;
			}
			if(newbiechannel[playerid] == 1)
   			{
     			SendClientMessage(playerid, COLOR_LIGHTGREEN," You closed the newbiechannel , use /togn.");
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GREEN, "USAGE: (/n)ewbie [Newbie Chat, Ask Questions]");
				return 1;
			}
			if (PlayerInfo[playerid][pHelper] < 1)
			{
				 format(string, sizeof(string), "* Newbie Level %d %s: %s", PlayerInfo[playerid][pLevel], sendername, result);
			}
			else
			{
				format(string, sizeof(string), "* Helper %s: %s", sendername, result);
			}
			if (PlayerInfo[playerid][pAdmin] >=1)
			{
                format(string, sizeof(string), "* Admin %s: %s", sendername, result);
			}
			for (new n=0; n<MAX_PLAYERS; n++)
			{
			    if (IsPlayerConnected(n) && (PlayerInfo[n][pLevel] < 4 || PlayerInfo[n][pAdmin] > 0 || PlayerInfo[n][pHelper] > 0))
			    {
			    if(newbiechannel[n] == 0)
       			{
			        SendClientMessage(n, COLOR_LIGHTGREEN, string);
			    }
			    }
			}
			printf("%s", string);
		}
		return 1;
	}
	//-------------------------------------[ nmute ]---------------------------------------
	if(strcmp(cmd, "/nmute", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /nmute [playerid/PartOfName]");
				return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
					    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						if(PlayerInfo[playa][pNMuted] == 0)
						{
							PlayerInfo[playa][pNMuted] = 1;
							printf("AdmCmd: %s silenced %s in Newbie chat",sendername,  giveplayer);
							format(string, sizeof(string), "AdmCmd: %s was silenced in Newbie chat by %s",giveplayer ,sendername);
							SendClientMessageToAll(COLOR_LIGHTRED,string);
							//ABroadCast(COLOR_LIGHTRED,string,1);
						}
						else
						{
							PlayerInfo[playa][pNMuted] = 0;
							printf("AdmCmd: %s unsilenced %s in Newbie chat",sendername,  giveplayer);
							format(string, sizeof(string), "AdmCmd: %s was unsilenced in Newbie chat by %s",giveplayer ,sendername);
							SendClientMessageToAll(COLOR_LIGHTRED,string);
							//ABroadCast(COLOR_LIGHTRED,string,1);
						}
						format(string, sizeof(string), "UPDATE profiles SET NMuted=%d WHERE Name='%s'", PlayerInfo[playa][pNMuted], giveplayer);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You do not have admin access, denied to use the command.");
			}
		}
		return 1;
	}
Reply
#4

@ zyghy - tu cum crezi ca am incercat sa fac textdraw-ul ? Imi da eroare la compilare, ceva gen: simbol "playerid" is not used .. ( deci raman pe varianta cu Fs )
Am rezolvat cu /rac.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)