25.09.2011, 15:08
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
on player stuff
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;
}
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;
}