Problem with ProxDetectorS
#1

Код:
if(strcmp(cmd, "/eventskin", true) == 0)
	{
	    GetPlayerName(playerid, sendername, sizeof(sendername));

	    if(IsPlayerConnected(playerid))
	    {
	        for(new i = 0; i < MAX_PLAYERS; i ++)
	        if(PlayerInfo[i][pHelper] >= 2 || PlayerInfo[i][pAdmin] >= 1 || ProxDetectorS(30.0, i,i))
	        {
	            tmp = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "{00A1FF}USAGE{FFFFFF}: /eventskin (1-4)");
						return 1;
					}
	            new nrs = strval(tmp);
	        	format(string, sizeof(string), "Admin %s has changed skin to everyone in 30 meters.", sendername);
	    		ProxDetector(30.0, playerid, string, COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED);
				{
				    if(IsPlayerConnected(i))
				    {
				        {
				        if(nrs == 1)
				        {
					    SetPlayerSkin(i, 31);
					    SetPlayerColor(i, COLOR_GOLD);
					    }
					    if(nrs == 2)
					    {
					    SetPlayerSkin(i, 32);
					    SetPlayerColor(i, 0xFF40BFAA);
					    }
					    if(nrs == 3)
					    {
					    SetPlayerSkin(i, 33);
					    SetPlayerColor(i, 0xBFFF00AA);
					    }
					    if(nrs == 4)
					    {
					    SetPlayerSkin(i, 34);
					    SetPlayerColor(i, 0xFF8000AA);
					    }
						if(nrs < 1 || nrs > 4)
						{
						    SendClientMessage(playerid, COLOR_GRAD2, "Numarul trebuie sa fie intre 1 si 4.");
						    return 1;
						}
						}
					}
				}
			}
		}
		return 1;
	}
First time working with ProxDetectorS, i tried to make a command to change the skin to every person in 30 meters but when i use /eventskin 2 for example it changes to skin to the player next to me , it should change it to me and appear the message x changed the skin but after that USAGE: /eventskin [1-4] why... here is a photo
Reply
#2

PHP код:
if(strcmp(cmd"/eventskin"true) == 0)
    {
        
GetPlayerName(playeridsendernamesizeof(sendername));

        if(
IsPlayerConnected(playerid))
        {
            for(new 
0MAX_PLAYERS++)
            if(
PlayerInfo[i][pHelper] >= || PlayerInfo[i][pAdmin] >= 1)
            {
                
tmp strtok(cmdtextidx);
                    if(!
strlen(tmp))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD2"{00A1FF}USAGE{FFFFFF}: /eventskin (1-4)");
                        return 
1;
                    }
                new 
nrs strval(tmp);
                
format(stringsizeof(string), "Admin %s has changed skin to everyone in 30 meters."sendername);
                
ProxDetector(30.0playeridstringCOLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED);
                {
                    if(
IsPlayerConnected(i) || ProxDetectorS(30.0i,i))
                    {
                        {
                        if(
nrs == 1)
                        {
                        
SetPlayerSkin(i31);
                        
SetPlayerColor(iCOLOR_GOLD);
                        }
                        if(
nrs == 2)
                        {
                        
SetPlayerSkin(i32);
                        
SetPlayerColor(i0xFF40BFAA);
                        }
                        if(
nrs == 3)
                        {
                        
SetPlayerSkin(i33);
                        
SetPlayerColor(i0xBFFF00AA);
                        }
                        if(
nrs == 4)
                        {
                        
SetPlayerSkin(i34);
                        
SetPlayerColor(i0xFF8000AA);
                        }
                        if(
nrs || nrs 4)
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"Numarul trebuie sa fie intre 1 si 4.");
                            return 
1;
                        }
                        }
                    }
                }
            }
        }
        return 
1;
    } 
Try with it, also show your ProxDetectorS function
Reply
#3

Not working, i have to write /eventskin 1 1 to change the skin to two players , i also have /eventheal the same command but is typing the message two times because there are two players..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)