PlayerPlaySound problem
#1

Im using Ravens roleplay GM by Cuervo_Negro
i modified the /kick command and add PlayPlayerSound on it.
but this function just played the sound for the kicked people and not for everyone.
i want to make it to be hear by everyone.someone please help me?

Код:
  if(strcmp(cmd, "/kick", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] <reason>");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, "* You Can't Do this on This player!");
      		new targetlevel = PlayerInfo[giveplayerid][pAdmin];
			new playerlevel = PlayerInfo[playerid][pAdmin];
			if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not Kick People that is higher Than You!");
			if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						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))
						{
							new y, m, d;
							new h,mi,s;
							getdate(y,m,d);
							gettime(h,mi,s);
							format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been kicked by %s, No Reason Given",d,m,y,h,mi,s,giveplayer,sendername);
							Kick(giveplayerid);
							KickLog(string);
							format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - No Reason Given.",d,m,y,h,mi,s,sendername);
							AddPunishment(giveplayerid, string);
							format(string, sizeof(string), " %s was kicked by %s | reason: [NO REASON GIVEN] ", giveplayer,sendername);
    						SendClientMessageToAll(COLOR_LIGHTRED, string);
							PlayerPlaySound(playerid,1130,0.0,0.0,0.0);
							Kick(giveplayerid);
							return 1;
						}
						new y, m, d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has been kicked by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
						KickLog(string);
						format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
						AddPunishment(giveplayerid, string);
						format(string, sizeof(string), "%s was kicked by %s, reason: %s ", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						PlayerPlaySound(playerid,1130,0.0,0.0,0.0);
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#2

You must loop it for all, like this:
pawn Код:
for(new i; i< GetMaxPlayers(); i++)
{
 if(!IsPlayerConnected(i)) continue;
 PlayerPlaySound(i, 1130, 0.0, 0.0, 0.0);
} //Close the bracket or else the loop will be going on.
Reply
#3

Ok.i will try that.thanks man.
Reply
#4

Ahh..its working.thanks again man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)