16.07.2011, 10:45
Hmm, I added some checks, still unsure though.
pawn Код:
/*
W O R K
*/
#include < a_samp >
#include < zcmd >
#include < sii >
#define COLOR_WHITE ( 0xFFFFFFAA )
#pragma tabsize 0 // lazy xD
enum e_work_info ( <<= 1 )
{
work_info_none,
work_info_boarding,
work_info_travelling
}
new
gCPInfo[ MAX_PLAYERS ] = { -1, ... },
e_work_info: gWorkInfo[ MAX_PLAYERS ] = { work_info_none, ... }
;
CMD:work( playerid, params[ ] )
{
if ( !IsPlayerInPlane( playerid ) )
return SendClientMessage( playerid, -1, "{AA0000}You are not in any plane." );
if ( gWorkInfo[ playerid ] != work_info_none )
return SendClientMessage( playerid, -1, "{AA0000}You are already working!" );
gWorkInfo[ playerid ] = work_info_travelling;
if(IsPlayerInRangeOfPoint(playerid, 1000, 1580.8534, 1534.2217, 10.8316))
{
gCPInfo[ playerid ] = 0;
SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}LVAP {FFFFFF}to {FFFF00}SFAP.");
SetPlayerCheckpoint(playerid, 1580.8534, 1534.2217, 10.8316, 5);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 1000, -1371.3795,-206.3711,14.1484))
{
gCPInfo[ playerid ] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}SFAP {FFFFFF}to {FFFF00}LSAP.");
SetPlayerCheckpoint(playerid, -1371.3795,-206.3711,14.1484, 5);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 1000, 1721.4504,-2415.5193,13.5547))
{
gCPInfo[ playerid ] = 2;
SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}LSAP {FFFFFF}to {FFFF00}LVAP.");
SetPlayerCheckpoint(playerid, 1721.4504, -2415.5193, 13.5547, 5);
return 1;
}
return 1;
}
CMD:stopwork( playerid, params[ ] )
{
if ( gWorkInfo[ playerid ] == work_info_none )
return SendClientMessage( playerid, -1, "{AA0000}You are not working!" );
gWorkInfo[ playerid ] = work_info_none;
SendClientMessage( playerid, -1, "{AA0000}You have stopped the mission." );
return 1;
}
public OnPlayerEnterCheckpoint( playerid )
{
if ( gWorkInfo[ playerid ] == work_info_travelling )
{
switch ( gCPInfo[ playerid ] )
{
case 0 :
{
if ( gWorkInfo[ playerid ] != work_info_travelling )
return -1;
SetPlayerCheckpoint(playerid, -1371.3795,-206.3711,14.1484, 5);
GameTextForPlayer(playerid,"~g~Passegers Boarded!",3000,3);
gWorkInfo[ playerid ] = work_info_boarding;
}
case 1 :
{
if ( gWorkInfo[ playerid ] != work_info_travelling )
return -1;
SetPlayerCheckpoint(playerid, 1721.4504,-2415.5193,13.5547, 5);
GameTextForPlayer(playerid,"~g~Passegers Boarded!",3000,3);
gWorkInfo[ playerid ] = work_info_boarding;
}
case 2 :
{
if ( gWorkInfo[ playerid ] != work_info_travelling )
return -1;
SetPlayerCheckpoint(playerid, 1580.8534,1534.2217,10.8316, 5);
GameTextForPlayer(playerid,"~g~Passegers Boarded!",3000,3);
}
}
}
if ( gWorkInfo[ playerid ] == work_info_boarding )
{
if ( gWorkInfo[ playerid ] != work_info_boarding )
return -1;
DisablePlayerCheckpoint( playerid );
gWorkInfo[ playerid ] = work_info_none;
GivePlayerMoney( playerid, 12000 );
SetPlayerScore( playerid, GetPlayerScore( playerid ) + 2 );
GameTextForPlayer( playerid, "~g~Mission finished", 3000, 3 );
}
return 1;
}
stock IsPlayerInPlane(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 593,592,577,563,553,548,520,519,513,512,511,
497,488,487,476,469,460,447,425,417,493,484,453: return 1;
default: return 0;
}
}
return 0;
}