SA-MP Forums Archive
Little Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little Help (/showthread.php?tid=216025)



Little Help - SanAndreasVille - 24.01.2011

how can i make when i type /radio and another /radio "Your Radio is allready on!"


Код:
	if(!strcmp(cmdtext, "/radio", true))
{
	if(Audio_IsClientConnected(playerid))
	{
                          SendClientMessage(playerid,YELLOW,"* Radio now On");
		base = Audio_PlayStreamed(playerid, "http://listen.base/dsl.pls");
	}
	else
	{
	SendClientMessage(playerid, COLOR_GREEN, "* No Audio Plugin installedl!");
	}
	return 1;
}



Re: Little Help - HyperZ - 24.01.2011

pawn Код:
if(!strcmp(cmdtext, "/radio", true))
{
    if (GetPVarInt(playerid, "RadioOn") == 1) return SendClientMessage(playerid, -1, "Your Radio is already on.");
    if(Audio_IsClientConnected(playerid))
    {
        SendClientMessage(playerid,YELLOW,"* Radio now On");
        base = Audio_PlayStreamed(playerid, "http://listen.base/dsl.pls");
        SetPVarInt( playerid, "RadioOn", 1 );
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREEN, "* No Audio Plugin installedl!");
    }
    return 1;
}



Re: Little Help - SanAndreasVille - 24.01.2011

thanks its work !


Re: Little Help - SanAndreasVille - 24.01.2011

Hello i can now not change the Volume what ist wrong ? hope everyone can help me


Код:
if(!strcmp(cmdtext, "/radioon", true))
{
	if (GetPVarInt(playerid, "RadioOn") == 1) return SendClientMessage(playerid,COLOR_GREEN, "* The Radio is allready On!");
	if(Audio_IsClientConnected(playerid))
	{
		SendClientMessage(playerid, COLOR_GREEN, "*Radio On");
		SendClientMessage(playerid, COLOR_GREEN, "* have Fun ");
		sound[playerid] = Audio_PlayStreamed(playerid, "http://sound/dsl.pls");
                                          SetPVarInt( playerid, "RadioOn", 1 );
                                          Loud[playerid] = strval(strget(cmdtext,1));
	}
	else
	{
	SendClientMessage(playerid, COLOR_GREEN, "* No Plugin inastalled!");
	}
	return 1;
}
	if(!strcmp(cmdtext, "/radiooff", true))
	{
		Audio_Stop(playerid,hardbase[playerid]);
		SendClientMessage(playerid, COLOR_GREEN, "* Radio off!");
	return 1;
	}
	
	
	if(!strcmp(cmdtext, "/volume", true))
	{
		if(!strlen(strget(cmdtext,1)))
  			{
   			SendClientMessage(playerid,COLOR_GREEN,"* Use: /volume [Volume 0-100 ]");
   			return 1;
  			}
 		new string[200];
  		Laut[playerid] = strval(strget(cmdtext,1));
		Audio_SetVolume(playerid, sound[playerid], Loud[playerid]);
		format(string, sizeof(string), "* Volume on %d ",Loud[playerid]);
    	SendClientMessage(playerid,COLOR_GREEN, string);
		return 1;
	}



Re: Little Help - SanAndreasVille - 25.01.2011

can someone help me ?


Re: Little Help - Ricop522 - 25.01.2011

pawn Код:
if(strcmp(cmd, "/volume", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /volume [1-100]");
return 1;
}
new volume = strval(tmp);
Audio_SetVolume(playerid, musicc[playerid], volume);
format(string, sizeof(string), "Volume %d", volume);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
return 1;
}



Re: Little Help - SanAndreasVille - 25.01.2011

Код:
E:\pwn(1051) : error 017: undefined symbol "cmd"
E:\pwn(1051) : error 017: undefined symbol "tmp"
E:\pwn(1051) : error 017: undefined symbol "idx"
E:\pwn(1051) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Little Help - Sasino97 - 25.01.2011

Quote:
Originally Posted by SanAndreasVille
Посмотреть сообщение
Код:
E:\pwn(1051) : error 017: undefined symbol "cmd"
E:\pwn(1051) : error 017: undefined symbol "tmp"
E:\pwn(1051) : error 017: undefined symbol "idx"
E:\pwn(1051) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
If you dont' have strtok put this at the end of file

Код:
stock strtok(const string[], &index)
{

	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}



Re: Little Help - SanAndreasVille - 25.01.2011

okay I've defined it but it does not come volume is always set to 0 then the music mute, but not to zero when i type / volume 5 no change the music mute i cant change the volume


Re: Little Help - SanAndreasVille - 27.01.2011

Help me please with the Volume script its not work