2 Errors, please help!
#1

Код:
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(167) : warning 215: expression has no effect
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(182) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(182) : warning 215: expression has no effect
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(342) : error 017: undefined symbol "StopRadioStreamForPlayer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
The lines:
167
Код:
166              {
167					islistening[playerid] == 1;
182
Код:
178  PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
179                    }
180        }
181    }
182 return 1;
183 }
342
Код:
341 {
342 	     StopRadioStreamForPlayer(playerid);
343	     SendClientMessage(playerid, C_RED, "You turned off the radio!");
344	 }
Line 160-350
Код:
}
        case DIALOG_RADIO:
        {
            switch(listitem)
            {
                case 0:
                {
					islistening[playerid] = 1;
					PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=352174");
				}
				case 1: 
                    {
                        islistening[playerid] = 1;
                        PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
                    }
    			case 2:
                    {
                        islistening[playerid] = 1;
                        PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
                    }
        }
    }
return 1;
}







CMD:armorme(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
SetPlayerArmour(playerid,100);
SendClientMessage(playerid,0xFF8000FF,"You have been armored by Vinay");

return 1;
}

CMD:grovest(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
SetPlayerPos(playerid,2493.6758, -1667.3986, 13.3438);
SendClientMessage(playerid,0xFF8000FF,"You have been teleported to Grove Street");
return 1;
}

CMD:help(playerid,params[])
{
SendClientMessage(playerid,0xFFFFFFAA,"/healme");
SendClientMessage(playerid,0xFFFFFFAA,"/armorme");
SendClientMessage(playerid,0xFFFFFFAA,"/grove");
SendClientMessage(playerid,0xFFFFFFAA,"/ogloc");
SendClientMessage(playerid,0xFFFFFFAA,"/kill");
SendClientMessage(playerid,0xFFFFFFAA,"/heal [id],/givemoney [ID] [Ammount], /setskin [id] [skinid]");
return 1;
}

CMD:kill(playerid,params[])
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,0xFF0000AA,"You have commited suicide.");
return 1;
}

CMD:heal(playerid,params[])
{
	new targetid;
	if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,0xFF0000AA,"Syntax error > /heal [id]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	SetPlayerHealth(targetid, 100);
	return 1;
}

CMD:givemoney(playerid,params[])
{
	new targetid;
	new ammount;
	if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command; /givemoney [playerid] [ammount]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	GivePlayerMoney(targetid, ammount);
	return 1;
}
	

CMD:setskin(playerid,params[])
{
	new targetid;
	new skinid;
	if(sscanf(params,"ui", targetid, skinid)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command; /givemoney [playerid] [ammount]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	SetPlayerSkin(targetid, skinid);
	return 1;
}

CMD:giveweapon(playerid,params[])
{
	new targetid;
	new weaponid;
	new ammo;
	if(sscanf(params,"ui", targetid, weaponid, ammo)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command; /giveweapon [playerid] [gunid]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	GivePlayerWeapon(targetid, weaponid, 1000);
	return 1;
}
	

CMD:sethp(playerid,params[])
{
	new targetid;
	new ammount;
	if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command; /sethp [id] [ammount]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	SetPlayerHealth(targetid, ammount);
	return 1;
}


CMD:setarmor(playerid,params[])
{
	new targetid;
	new ammount;
	if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command; /setarmor [id] [ammount]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,0xFF0000AA,"That player is not connected");
	if(!IsPlayerAdmin(playerid)) return SendClientMessage (playerid,0xFF0000AA,"You're not authorized to use this command");
	SetPlayerArmour(targetid, ammount);
	return 1;
}


CMD:kick(playerid,params[])
{
	new id,reason[128];
	if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000AA,"You are not authorized to use this command!");
	else if(sscanf(params,"us",id,reason))SendClientMessage(playerid,0xFFFFFFAA,"Usage:/kick [playerid/partofname][reason]");
	else if(id==playerid)SendClientMessage(playerid,0xFFFFFFAA,"You cannot kick yourself");
	else if(IsPlayerAdmin(id))SendClientMessage(playerid,0xFFFFFFAA,"You can't kick admins.");
	else if(id==INVALID_PLAYER_ID)SendClientMessage(playerid,0xFFFFFFAA,"This player is not connected.");
	else {
 		 new Name[MAX_PLAYER_NAME], KickMessage[128];
    	 new Name2[MAX_PLAYER_NAME];
  		 GetPlayerName(playerid,Name,sizeof(Name));
    	 GetPlayerName(id,Name2,sizeof(Name2));
    	 format(KickMessage,sizeof(KickMessage),"%s(%d) has kicked %s(%d). Reason: %s",Name,playerid,Name2,id);
    	 SendClientMessageToAll(0x8B4513AA,KickMessage);
    	 Kick(id);
 	}
	return 1;
}

CMD:grove(playerid,params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 2152, -1787, 13.5)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command, or you are not near your locker");
	ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "{FFFFFF}Choose a gun:", " Spas \t$500\n M4 \t\t$100\n Sniper Rifle \t$400", "Choose","");
	return 1;
}

CMD:ballas(playerid,params[])
{
	if(IsPlayerInRangeOfPoint(playerid, 10.0, 2533, -1664.35, 15.20)) return SendClientMessage(playerid,0xFF0000AA,"Use the right command, or you are not near your locker");
	ShowPlayerDialog(playerid, DIALOG_LOCKER, DIALOG_STYLE_LIST, "{FFFFFF}Choose a gun:", " Spas \t\t$500\n M4 \t\t$100\n Sniper Rifle \t$400", "Choose","");
	return 1;
}

CMD:radio(playerid,params[])
{
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, C_RED, "You aren't in a Vehicle!");
	ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_LIST, "{FFFFFF}Radio Stations:", "Powerhitz\n DefJay\n TheHitzChannel", "Choose", "Cancel");
	return 1;
}

CMD:stopradio(playerid,params[])
{
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, C_RED, "You aren't in a vehicle!");
	if(islistening[playerid] == 1)
	{
	    StopRadioStreamForPlayer(playerid);
	    SendClientMessage(playerid, C_RED, "You turned off the radio!");
	}
	else
	{
	    SendClientMessage(playerid, C_RED, "You aren't listening to the radio!");
	}
	return 1;
}
The particular Switch:
Код:
case DIALOG_RADIO:
        {
            switch(listitem)
            {
                case 0:
                {
					islistening[playerid] = 1;
					PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=352174");
				}
				case 1: 
                    {
                        islistening[playerid] = 1;
                        PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
                    }
    			case 2:
                    {
                        islistening[playerid] = 1;
                        PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
                    }
             }
	}
 	return 1;
 }
Reply
#2

Show us the lines that gives those errors.
Reply
#3

Show code..
Reply
#4

First of all, you are setting the variable to a value, not checking it.
So replace == with a single =...

pawn Код:
islistening[playerid] = 1;
as for the rest, we need to see the code for those.
Reply
#5

Quote:
Originally Posted by Roel
Посмотреть сообщение
Show us the lines that gives those errors.
Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
Show code..
Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
First of all, you are setting the variable to a value, not checking it.
So replace == with a single =...

pawn Код:
islistening[playerid] = 1;
as for the rest, we need to see the code for those.
There you go boys. Thanks for the fast reactions.
Reply
#6

Can you post lines 160 - 350 ??


We need to see the code above these lines in order to fix the errors appropriately. :P
Reply
#7

Код:
166              {
167					islistening[playerid] = 1;
182
Код:
178  PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
179                    }
180        }
181    }
182 return 1;
183 }
342
Код:
341 {
342 	     StopAudioStreamForPlayer(playerid);
343	     SendClientMessage(playerid, C_RED, "You turned off the radio!");
344	 }
[/QUOTE]
Reply
#8

Quote:
Originally Posted by Roel
Посмотреть сообщение
Код:
				islistening[playerid] = 1;
182
Код:
178  PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
179                    }
180        }
181    }
182 return 1;
183 }
Thanks for the others, those worked. But this one still gives the same Error.

Код:
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(182) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Vinay\Desktop\Samp Server\gamemodes\VinayServer.pwn(182) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#9

This is the code from the beginning:

Код:
175	case 2:
176                    {
177                        islistening[playerid] = 1;
178                        PlayAudioStreamForPlayer(playerid,"http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283516&play_status=1");
179                   }
180        }
181	}
182 	return 1; //there is something wrong with this, but I don't know what.
183 }
Reply
#10

Show us the complete switch()
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)