never get paid what's wrong ? -
[LHT]Bally - 25.09.2011
hi i got this script put in my server and it works ok apart from the player dont show up red who needs the ride and also the taxi driver never gets paid
anyone help ?
Command
pawn Код:
if(!strcmp(cmdtext, "/duty", true))
{ if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not a Cabbie!");
if(OnDuty[playerid] == true)//<<is on duty
{
SendClientMessage(playerid, COLOR_WHITE, "{ff0000}You are now off duty You will no longer recieve calls");
OnDuty[playerid] = false;//<<is now off duty
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{00ff00}You are now on duty!");
SendClientMessage(playerid, COLOR_WHITE, "{00ff00}You will receive a message when a player needs a ride");
OnDuty[playerid] = true;//<<is now on duty
}
return 1;
}
if(!strcmp(cmdtext, "/taxi", true))
{
// prevent spamming
if(Called[playerid] == true)
{
return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}PLEASE WAIT BEFORE CALLING AGAIN");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{00ff00}[Taxi Company] {00ffff} Driver on the way.");
SetTimerEx("CalledTaxi", 600000, false, "i", playerid); //Changed to 600000 -> ~10 minutes
Called[playerid] = false;
for(new i; i < MAX_PLAYERS; i++)
{
if(OnDuty[i] == true)
{
SendTaxiMessage(playerid, COLOR_WHITE);
}
}
}
return 1;
}
on player stuff
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(Called[playerid] == true)
{
new paid[128];
format(paid, sizeof paid, "[INFO] You have paid the taxi driver %d", pAmount[playerid]);
SendClientMessage(playerid, COLOR_WHITE, paid);
SendClientMessage(playerid, COLOR_WHITE, "{00ffff}[Taxi Driver]Thank you!"); // random message
KillTimer(fairtime_timer);
pAmount[playerid] = 0;
}
return 1;
}
forward CalledTaxi(playerid);
forward FairTime(playerid);
public CalledTaxi(playerid)
{
return Called[playerid] = false;
}
public FairTime(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new seat = GetPlayerVehicleSeat(playerid), Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(seat == 1 || seat == 2 || seat == 3)
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid)-5);
SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[PAYMENT] You have paid the taxi driver $5");
pAmount[playerid] += 5;
}
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 3, x, y, z))
{
new vehicle = GetPlayerVehicleID(i), model = GetVehicleModel(vehicle);
if(model == 420 || model == 438)
{
GivePlayerMoney(i, GivePlayerMoney(i, GetPlayerMoney(i)+5));
SendClientMessage(i, COLOR_WHITE, "{00ff00}[PAYMENT] You have been paid $5 by the passenger");
}
}
}
return 1;
}
stock SendTaxiMessage(playerid, color)
{
new message[126], caller[MAX_PLAYER_NAME];
GetPlayerName(playerid, caller, sizeof(caller));
format(message, sizeof(message), "{ff0000}%s has called a taxi!", caller);
for(new i; i < MAX_PLAYERS; i++)
{
if(OnDuty[i] == true)
{
SendClientMessage(i, color, message);
}
}
return 1;
}
Re: never get paid what's wrong ? -
aRoach - 25.09.2011
Try This:
pawn Код:
public FairTime( playerid )
{
if( !IsPlayerInAnyVehicle( playerid ) ) return ( 0 );
new seat = GetPlayerVehicleSeat( playerid ), Float:x, Float:y, Float:z;
GetPlayerPos( playerid, x, y, z );
if( seat == 1 || seat == 2 || seat == 3 )
{
GivePlayerMoney( playerid, -5 );
SendClientMessage( playerid, COLOR_WHITE, "{ff0000}[PAYMENT] You have paid the taxi driver $5" );
pAmount[ playerid ] += 5;
}
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
if( IsPlayerInRangeOfPoint( i, 3, x, y, z ) )
{
new vehicle = GetPlayerVehicleID( i ), model = GetVehicleModel( vehicle );
if( model == 420 || model == 438 )
{
GivePlayerMoney( i, 5 );
SendClientMessage( i, COLOR_WHITE, "{00ff00}[PAYMENT] You have been paid $5 by the passenger" );
}
}
}
return 1;
}
Re: never get paid what's wrong ? -
[LHT]Bally - 25.09.2011
still no payment and the player and the person who called a taxi how i make there marker show up red on mini map
Re: never get paid what's wrong ? -
[MWR]Blood - 25.09.2011
This should do it.
pawn Код:
public FairTime(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
GivePlayerMoney(playerid, -5);
SendClientMessage(playerid, COLOR_WHITE, "{ff0000}[PAYMENT] You have paid the taxi driver $5");
pAmount[playerid] += 5;
}
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i), model = GetVehicleModel(vehicle);
if(model == 420 || model == 438)
{
GivePlayerMoney(i, GivePlayerMoney(i, 5));
SendClientMessage(i, COLOR_WHITE, "{00ff00}[PAYMENT] You have been paid $5 by the passenger");
}
}
}
return 1;
}
Also, where are you executing the timer which calls the FairTime callback?
Re: never get paid what's wrong ? -
[LHT]Bally - 25.09.2011
i wouldnt know lol
Re: never get paid what's wrong ? -
[MWR]Blood - 25.09.2011
Alright, replace the current script you have with the one I posted above (if you didn't do it yet), and add this under OnGameModeInit / OnFilterScriptInit
pawn Код:
SetTimer("FairTime",10000,1);
Re: never get paid what's wrong ? -
[LHT]Bally - 25.09.2011
will that set the player who called for a taxi red on map ?
Re: never get paid what's wrong ? -
[LHT]Bally - 25.09.2011
also its stil not loosing money from player who calls a taxi and the cabbie dont recieve money
Re: never get paid what's wrong ? -
[LHT]Bally - 26.09.2011
aanyone
Re: never get paid what's wrong ? -
[LHT]Bally - 26.09.2011
really need someones help with this ive been struggling for 2 weeks now