strfind little help
#1

Код:
		    else if (PlayerU2B[playerid] == 2)
		    {
		        if(strfind(string, ".mp3", true))
		        {
			   		for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
		    				PlayAudioStreamForPlayer(i, inputtext);
			        	}
					}
					new sendername[128];
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "%s has donated to charity and has selected to play an mp3 file to all players on the server [/stopmp3 to stop the playback]", sendername);
					SendClientMessageToAll(COLOR_YELLOW, string);
				}
				else
				{
				    SendClientMessage(playerid, COLOR_YELLOW, "This Audio URL will not work. Please enter another. Make sure it has .mp3 on the end of the URL");
				    ShowPlayerDialog(playerid,U2BDIAG+1,DIALOG_STYLE_INPUT,WHOMADETHIS,"Paste the mp3 link you want to play for the whole server:","Play","Cancel");
				}
			}
This is my code. but it does not work. when i type in a link that doesnt contain mp3, the server still accepts it... how can i fix this problem?

Thanks
Reply
#2

strfind returns the position of the first character of the substring in the main string (if found). It returns -1 if it doesn't find it.

Learn to read the wiki: https://sampwiki.blast.hk/wiki/Strfind
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)