#1

Can somebody help me with this comand ive been working on it too much and
Please help me fix it:i want to putmore radio stations and to change radios using Numpad 4&6 please help me fix the command!


Код:
#pragma tabsize 0
#include <a_samp>
#define HOLDING(%0) \
	((newkeys & (%0)) == (%0))
#define PRESSED
//-------------------------------------------------

public OnFilterScriptInit()
{
	return 1;
}
//-------------------------------------------------

public OnPlayerStateChange(playerid, newstate, oldstate)
{


  
    if (PRESSED(KEY_ACTION))
	{
	if (IsPlayerInAnyVehicle(playerid))
		{
           new vehid = GetPlayerVehicleID(playerid);
	       for(new i = 0; i<MAX_PLAYERS; i++)
	       }
        	else if (RELEASED(KEY_ACTION))
	        {

	        }
	return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
	if(!IsPlayerConnected(playerid)) return 0;
	if(IsPlayerNPC(playerid)) return 1;
	
	// Handle playing SomaFM at the alhambra
	if(GetPlayerInterior(playerid) == 17) {
	    if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
	    	if(!GetPVarInt(playerid,"alhambra")) {
	    	    SetPVarInt(playerid,"alhambra",1);
	    	    PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
			}
		}
	}
	else {
		if(GetPVarInt(playerid,"alhambra")) {
	  		DeletePVar(playerid,"alhambra");
	   		StopAudioStreamForPlayer(playerid);
		}
	}
	
	return 1;
}

//-------------------------------------------------
4 Errors.and warns!

Код:
warning 206: redundant test: constant expression is non-zero
 error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "else"
warning 217: loose indentation
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Reply
#2

is anyone helping me??where can i get more of this?? (#define C_RED "{AA3333}")
Reply
#3

You are using wrong Callback.
It should be on OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
pawn Код:
#include <a_samp>
#pragma tabsize 0
// PRESSED(keys)
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
// RELEASED(keys)
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
// PRESSED(keys)
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//-------------------------------------------------

public OnFilterScriptInit()
{
    return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ACTION)) {
        if(IsPlayerInAnyVehicle(playerid)) {
            new vehid = GetPlayerVehicleID(playerid);
            // warning 204: symbol is assigned a value that is never used: "vehid"
            // You have to use it somewhere and it will compile without warnings too as without errors.
            for(new i = 0; i<MAX_PLAYERS; i++) {
                // Code Here
            }
        }
        else if(RELEASED(KEY_ACTION)) {
                // Code Here
        }
    }
    return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    // Handle playing SomaFM at the alhambra
    if(GetPlayerInterior(playerid) == 17) {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
            }
        }
    }
    else {
        if(GetPVarInt(playerid,"alhambra")) {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}

//-------------------------------------------------
Reply
#4

man i cant copy it..
Reply
#5

can you help me fix this

Код:
#include <a_samp
#pragma tabsize 0/
// PRESSED(keys)
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))// RELEASED(keys)
#define RELEASED(%0) \    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))// PRESSED(keys)
#define PRESSED(%0)(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//-------------------------------------------------

public OnFilterScriptInit()
{
	return 1;
}
//-------------------------------------------------

public OnPlayerStateChange(playerid, newstate, oldstate)
{

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ACTION)){
		if(IsPlayerInAnyVehicle(playerid)) {
        new vehid = GetPlayerVehicleID(playerid);
	    for(new i = 0; i<MAX_PLAYERS; i++)
		{                
              	PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fg.pls");
							SendClientMessage(i, 0xFF330000, "Now Playing: Radio FG");
						}
					}
					return 1;
				}
				case 1:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fgu.pls");
							SendClientMessage(i, 0xFF330000, "Now Playing: Underground FG");
						}
					}
					return 1;
				}
				case 2:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://www.radiofeeds.co.uk/112s.png");
							SendClientMessage(i, 0xFF330000, "Now Playing: Kiss 100");
						}
					}
					return 1;
				}
			}
		}
	}
	return 1;
}
	}
    else if(RELEASED(KEY_ACTION))}

	}
  }
  return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
	if(!IsPlayerConnected(playerid)) return 0;
	if(IsPlayerNPC(playerid)) return 1;

	// Handle playing SomaFM at the alhambra
	if(GetPlayerInterior(playerid) == 17) {
	    if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
	    	if(!GetPVarInt(playerid,"alhambra")) {
	    	    SetPVarInt(playerid,"alhambra",1);
	    	    PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
			}
		}
	}
	else {
		if(GetPVarInt(playerid,"alhambra")) {
	  		DeletePVar(playerid,"alhambra");
	   		StopAudioStreamForPlayer(playerid);
		}
	}

	return 1;
}

//-------------------------------------------------
Reply
#6

can someone help me??or all of you are selfish
Reply
#7

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
can someone help me??or all of you are selfish
Erm.. don't tell things about others. I already gave the code I fixed and I told you that you can not use
pawn Код:
if(PRESSED..// More
OnPlayerStateChange callback but OnPlayerKeyStateChange
pawn Код:
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
// PRESSED(keys)
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
//-------------------------------------------------

public OnFilterScriptInit()
{
    return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ACTION)) {
        if(IsPlayerInAnyVehicle(playerid)) {
            new vehid = GetPlayerVehicleID(playerid);
            // warning 204: symbol is assigned a value that is never used: "vehid"
            // You have to use it somewhere and it will compile without warnings too as without errors.
            for(new i = 0; i<MAX_PLAYERS; i++) {
                // Code Here
            }
        }
        else if(RELEASED(KEY_ACTION)) {
                // Code Here
        }
    }
    return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    // Handle playing SomaFM at the alhambra
    if(GetPlayerInterior(playerid) == 17) {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
            }
        }
    }
    else {
        if(GetPVarInt(playerid,"alhambra")) {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}

//-------------------------------------------------
Reply
#8

how do i put the radio in without warns and errors??
Reply
#9

10 Errors.

Код:
warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
 warning 235: public function lacks forward declaration (symbol "OnPlayerKeyStateChange")
 error 017: undefined symbol "KEY_ACTION"
 error 017: undefined symbol "IsPlayerInAnyVehicle"
 error 001: expected token: "-identifier-", but found "="
 warning 217: loose indentation
 error 017: undefined symbol "MAX_PLAYERS"
 error 017: undefined symbol "PlayAudioStreamForPlayer"
 error 017: undefined symbol "SendClientMessage"
 warning 217: loose indentation
 error 029: invalid expression, assumed zero
 warning 215: expression has no effect
 error 001: expected token: ";", but found "if"
 error 017: undefined symbol "KEY_ACTION"
 fatal error 107: too many error messages on one line
MY codelease help me fix it!+fix radio!

Код:
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define vehid
//-------------------------------------------------

public OnFilterScriptInit()
{
    return 1;
}
//-------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_ACTION)) {
        if(IsPlayerInAnyVehicle(playerid))
		{
		new vehid = GetPlayerVehicleID(playerid);
         for(new i = 0; i<MAX_PLAYERS; i++) {
		{
		PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fg.pls");
		SendClientMessage(i, 0xFF330000, "Now Playing: Radio FG");
      }
      else if(RELEASED(KEY_ACTION)) {
      {
		PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fgu.pls");
		SendClientMessage(i, 0xFF330000, "Now Playing: Underground FG");
        }
    }
    return 1;
}
//-------------------------------------------------

public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    // Handle playing SomaFM at the alhambra
    if(GetPlayerInterior(playerid) == 17) {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls",480.9575,-3.5402,1002.0781,40.0,true);
            }
        }
    }
    else {
        if(GetPVarInt(playerid,"alhambra")) {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}
Reply
#10

Put this on the top of your script:

Код:
#include <a_samp>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)