03.01.2012, 17:25
You are using wrong Callback.
It should be on OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
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;
}
//-------------------------------------------------