cabbie script
#1

delete this please because its classed as spam :S by people.
Reply
#2

yes you could
Reply
#3

would you say it would be rather easy or hard , i want it so the cabbie had to type /fare to see that players need a taxi if no /fare is wrote they are off duty
Reply
#4

We cannot say if it's hard or not. That depends on the scripter - in this case you. I see that you are kinda new with this so I think it's hard for you.
Reply
#5

Working on it
Reply
#6

thankyou so much
Reply
#7

Editted this one by accident
Reply
#8

forgot to add my game mode is in if(!strcmp(command, "/hy",true)) :S so wouldnt even no where to put that lol
Reply
#9

Here you go
If there is anything missing, please tell me

On top of your script

pawn Код:
new bool:OnDuty[MAX_PLAYERS], bool:Called[MAX_PLAYERS], fairtime_timer, pAmount[MAX_PLAYERS];
Add this at OnPlayerCommandText
pawn Код:
if(strcmp(cmdtext, "/duty", true))
{
    if(OnDuty[playerid] == true)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are now off duty!");
        SendClientMessage(playerid, COLOR_WHITE, "You will no longer receive duty messages");
        OnDuty[playerid] = false;
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are now on duty!");
        SendClientMessage(playerid, COLOR_WHITE, "You will receive a message when a player needs a ride");
        OnDuty[playerid] = false;
    }
    return 1;
}

if(strcmp(cmdtext, "/fare", true))
{
    // prevent spamming
    if(Called[playerid] == true)
    {
        return SendClientMessage(playerid, COLOR_WHITE, "Please wait while calling a taxi!");
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You have called a taxi, you have to wait 2 minutes to make a new call");
        SendClientMessage(playerid, COLOR_WHITE, "[PAYMENT] You have to pay $5 each 10 minutes (game minutes)");
        SetTimerEx("CalledTaxi", 1000*60*120, false, "i", playerid);
        Called[playerid] = false;
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(OnDuty[i] == true)
            {
                SendTaxiMessage(playerid, COLOR_WHITE);
            }
        }
    }
    return 1;
}
The rest speaks for itself
pawn Код:
forward CalledTaxi(playerid);
forward FairTime(playerid);

public CalledTaxi(playerid)
{
    return Called[playerid] = false;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(Called[playerid] == true)
    {
        new model = GetVehicleModel(vehicleid);
        if(model == 420 || model == 438)
        {
            fairtime_timer = SetTimerEx("FairTime", 1000*10, true, "i", playerid);
        }
    }
    return 1;
}

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, "[Taxi Driver] Thank you for driving!"); // random message
        KillTimer(fairtime_timer);
        pAmount[playerid] = 0;
    }
    return 1;
}

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, "[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, "[PAYMENT] You have been paid $5 by the passenger");
            }
        }
    }
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    pAmount[playerid] = 0;
    return 1;
}

stock SendTaxiMessage(playerid, color)
{
    new message[126], caller[MAX_PLAYER_NAME];
    GetPlayerName(playerid, caller, sizeof(caller));
    format(message, sizeof(message), "%s has called a taxi!", caller);
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(OnDuty[i] == true)
        {
                SendClientMessage(i, color, message);
        }
    }
    return 1;
}
Reply
#10

pawn Код:
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(153) : warning 217: loose indentation
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(302) : warning 217: loose indentation
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1474) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1475) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1480) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1481) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1487) : warning 217: loose indentation
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1492) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1496) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1497) : error 017: undefined symbol "COLOR_WHITE"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1504) : error 017: undefined symbol "SendTaxiMessage"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(1512) : warning 217: loose indentation
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(2580) : warning 203: symbol is never used: "fairtime_timer"
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\gamemodes\TLG_v1.0.pwn(2580) : warning 203: symbol is never used: "pAmount"
i get this on the player command text stuff i no how to define colours
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)