#include <a_samp>
#include <a_colors>
#include <JunkBuster>
//Planes that require 0 score:
//Dodo
//Beagle
//Nevada
//Stuntplane
//Maverick
//Skimmer
//Cropduster
//Planes that require 20 Score:
//Shamal
//Raidence
//Cargobob
//Planes that require 40 Score:
//AT-400
//Andromada
//Leviathan
//Planes that require 60 score:
//Hydya
//Hunter
//Rustler
//Planes that are not used ingame:
//Sparow
//Seasparow
//Police Maverick
//News Maverick
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
//20 Score Aircraft
if(GetPlayerScore(playerid, < 20) && IsPlayerInVehicle(playerid, 519))
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 20) && IsPlayerInVehicle(playerid, 563))
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 20) && IsPlayerInVehicle(playerid, 548))
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
else
//40 Score Aircraft
if(GetPlayerScore(playerid, < 40) && IsPlayerInVehicle(playerid, 577))
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 40) && IsPlayerInVehicle(playerid, 592))
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 40) && IsPlayerInVehicle(playerid, 417))
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
else
//60 Score Aircraft
if(GetPlayerScore(playerid, < 60) && IsPlayerInVehicle(playerid, 520))
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 60) && IsPlayerInVehicle(playerid, 592))
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
else
if(GetPlayerScore(playerid, < 60) && IsPlayerInVehicle(playerid, 425))
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
return 1;
}
C:\Documents and Settings\Ed\My Documents\SAMP Virtual Pilots\filterscripts\ScoreVehicle.pwn(34) : error 029: invalid expression, assumed zero C:\Documents and Settings\Ed\My Documents\SAMP Virtual Pilots\filterscripts\ScoreVehicle.pwn(34) : warning 215: expression has no effect C:\Documents and Settings\Ed\My Documents\SAMP Virtual Pilots\filterscripts\ScoreVehicle.pwn(34) : error 001: expected token: ";", but found ")" C:\Documents and Settings\Ed\My Documents\SAMP Virtual Pilots\filterscripts\ScoreVehicle.pwn(34) : error 029: invalid expression, assumed zero C:\Documents and Settings\Ed\My Documents\SAMP Virtual Pilots\filterscripts\ScoreVehicle.pwn(34) : 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(GetPlayerScore(playerid, > 20) && IsPlayerInVehicle(playerid, 519))
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
//20 Score Aircraft
if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 519) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 563) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 548) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
}
//40 Score Aircraft
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 577) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 417) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
}
//60 Score Aircraft
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 520) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 425) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//The players state has changed from on foot to in a vehicle.
//Check whether it's the vehicle here.
}
return 1;
}
enum cPlaneData_ENUM
{
//enum of variables for plane data, so we can access them easier
nScore,
nVeh,
szVehName[ 64 ],
};
new cPlaneData[ ][ cPlaneData_ENUM ] =
{
//nScore, nVeh, nVehName
//0 , 1, 2
{ 20, 519, "Shamal" },
{ 20, 563, "Raindance" },
{ 20, 548, "Cargobob" },
{ 40, 577, "AT-400" },
{ 40, 592, "Andromada" },
{ 40, 417, "Leviathan" },
{ 60, 520, "Hydra" },
{ 60, 592, "Rustler" },
{ 60, 425, "Hunter" }
};
public OnPlayerStateChange(playerid,newstate,oldstate)
{
//The players state changed
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//They're now a driver.
for( new i=0; i < sizeof cPlaneData; i++ )
{
//Loop through array for plane data
if( IsPlayerInVehicle(playerid, cPlaneData[ i ][ nVeh ]) )
{
//They're in the vehicle from the array
if( GetPlayerScore(playerid) < cPlaneData[ i ][ nScore ] )
{
//If the players score is less than the defined score for this vehicle
new szStr[ 128 ];
format( szStr, sizeof szStr, "You need %d flying minutes (%d Score) to use the %s!", cPlaneData[ i ][ nScore ], cPlaneData[ i ][ nScore ], cPlaneData[ i ][ szVehName ] );
//Send message and remove them.
SendClientMessage( playerid, COLOR_RED, szStr );
RemovePlayerFromVehicle( playerid );
}
}
}
}
return 1;
}
enum cPlaneData_ENUM
{
//enum of variables for plane data, so we can access them easier
nScore,
nVeh,
szVehName[ 64 ],
};
new cPlaneData[ ][ cPlaneData_ENUM ] =
{
//nScore, nVeh, nVehName
//0 , 1, 2
{ 20, 519, "Shamal" },
{ 20, 563, "Raindance" },
{ 20, 548, "Cargobob" },
{ 40, 577, "AT-400" },
{ 40, 592, "Andromada" },
{ 40, 417, "Leviathan" },
{ 60, 520, "Hydra" },
{ 60, 592, "Rustler" },
{ 60, 425, "Hunter" }
};
public OnPlayerStateChange(playerid,newstate,oldstate)
{
//The players state changed
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//They're now a driver.
for( new i=0; i < sizeof cPlaneData; i++ )
{
//Loop through array for plane data
if( IsPlayerInVehicle(playerid, cPlaneData[ i ][ nVeh ]) )
{
//They're in the vehicle from the array
if( GetPlayerScore(playerid) < cPlaneData[ i ][ nScore ] )
{
//If the players score is less than the defined score for this vehicle
new szStr[ 128 ];
format( szStr, sizeof szStr, "You need %d flying minutes (%d Score) to use the %s!", cPlaneData[ i ][ nScore ], cPlaneData[ i ][ nScore ], cPlaneData[ i ][ szVehName ] );
//Send message and remove them.
SendClientMessage( playerid, COLOR_RED, szStr );
RemovePlayerFromVehicle( playerid );
}
}
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
//20 Score Aircraft
if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 519) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 563) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 548) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
}
//40 Score Aircraft
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 577) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 417) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
}
//60 Score Aircraft
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 520) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 425) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//20 Score Aircraft
if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 519) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 563) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 548) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
}
//40 Score Aircraft
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 577) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 417) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
}
//60 Score Aircraft
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 520) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 425) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
return 0;
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//20 Score Aircraft
if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 519) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 563) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 548) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
}
//40 Score Aircraft
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 577) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 417) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
}
//60 Score Aircraft
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 520) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 425) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
erm. I tested all the code I posted and it worked fine..
as for the OnPlayerStateChange code you posted, you're returning 0 at the end of the callback, try this? : pawn Код:
|
#include <a_samp>
#include <a_colors>
#include <JunkBuster>
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if( oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER )
{
//20 Score Aircraft
if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 519) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Shamal!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 563) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Raindance!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 20) && IsPlayerInVehicle(playerid, 548) )
{
SendClientMessage(playerid, COLOR_RED, "You need 20 flying minutes (20 Score) to use the Cargobob!");
RemovePlayerFromVehicle(playerid);
}
//40 Score Aircraft
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 577) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the AT-400!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Andromada!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 40) && IsPlayerInVehicle(playerid, 417) )
{
SendClientMessage(playerid, COLOR_RED, "You need 40 flying minutes (40 Score) to use the Leviathan!");
RemovePlayerFromVehicle(playerid);
}
//60 Score Aircraft
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 520) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hydra!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 592) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Rustler!");
RemovePlayerFromVehicle(playerid);
}
else if( (GetPlayerScore(playerid) < 60) && IsPlayerInVehicle(playerid, 425) )
{
SendClientMessage(playerid, COLOR_RED, "You need 60 flying minutes (60 Score) to use the Hunter!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}