SA-MP Forums Archive
Noob question - 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)
+--- Thread: Noob question (/showthread.php?tid=368983)



Noob question - BigAl - 15.08.2012

Hey, I haven't scripted for a very long time and I finally found a few radio stations that will work with sa-mp that I like and enjoy listening to... I have made the command fine and all that's working. But I forgot how to make it so that if you're not listening to the radio and you type /stopradio it turns around and tells you that your not listening to the radio, but if you are it carry's on with the command.

Код:
COMMAND:radio(playerid,cmdtext)
{
	new islisteningtoradio[MAX_PLAYERS];
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have to be in a vehicle to perform this command!");
	{
		ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"Radio Stations:","1. HotJamz\r\n2. TheBeat\r\n3. PowerHitz\r\n4. Hit104\r\n5. More will be added soon!","Listen","Cancel");
		islisteningtoradio[playerid] = 1;
	}
	return 1;
}
COMMAND:stopradi(playerid,cmdtext)
{
	new islisteningtoradio[MAX_PLAYERS];
	if(!islisteningtoradio[playerid] == 1);
	{
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "You're already listening to the radio!");
	]
	return 1;
}
Код:
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1054) : warning 213: tag mismatch
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1054) : error 036: empty statement
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1057) : error 029: invalid expression, assumed zero
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1060) : warning 217: loose indentation
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1060) : error 029: invalid expression, assumed zero
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1060 -- 1061) : warning 215: expression has no effect
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1061) : error 001: expected token: ";", but found "return"
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : warning 225: unreachable code
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : warning 217: loose indentation
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : error 029: invalid expression, assumed zero
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : error 017: undefined symbol "cmd_drift1"
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : error 029: invalid expression, assumed zero
F:\Games\SA-MP\Dv drift\Dv drift\gamemodes\dvdrift.pwn(1064) : fatal error 107: too many error messages on one line

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


8 Errors.
PS: Been over a year since I have scripted therefore I am a complete newbie once again... :P


Re: Noob question - [MM]RoXoR[FS] - 15.08.2012

Код:
new islisteningtoradio[MAX_PLAYERS];
should be gloobal


Re: Noob question - BigAl - 15.08.2012

That worked slightly... but now i have a problem with
Код:
islisteningtoradio[playerid] == 1;



Re: Noob question - BigAl - 15.08.2012

FIXED


Re: Noob question - [MM]RoXoR[FS] - 15.08.2012

pawn Код:
new islisteningtoradio[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    islisteningtoradio[playerid]=0;
    return 1;
}

COMMAND:radio(playerid,params)
{
    #pragma unused params
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You have to be in a vehicle to perform this command!");
    {
        ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"Radio Stations:","1. HotJamz\r\n2. TheBeat\r\n3. PowerHitz\r\n4. Hit104\r\n5. More will be added soon!","Listen","Cancel");
        islisteningtoradio[playerid] = 1;
    }
    return 1;
}
COMMAND:stopradi(playerid,params)
{
    #pragma unused params
    if(islisteningtoradio[playerid] == 0)
    {
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You're already listening to the radio!");
    }
    return 1;
}