Can Someone Please Help
#1

Hi all i was wondering if anyone could help with this bit of code.

Reason for help needed : when i put into my gamemode it takes over everything.

so say like if its in my gamemode , and i go in game and type any command that is stored in my gamemode, then all i see is messages saying you are now on duty, but soon as i remove this code from my gamemode my commands are fine.
if you can help me i will be so gratefull

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;
}
Reply
#2

Wich one doens't work.
Reply
#3

well if i type any command that is stored in my gamemode, all it says is you are now on duty but the cabbie class never goes on duty so i think there is something wrong in script somewhere , it is very confusing
Reply
#4

So you're saying if you type another command in your script that also starts with /fa or /du, the two commands above interfere with them ?
Reply
#5

no what i am saying is once this is put in my gamemode, no other command in my gamemode work, so /rules and it says you are now on duty.

basically once this is put in my gamemode it takes over all commands , and the class doesnt work because if someone calls for a taxi it doesnt say anything to the on duty cabbie.
Reply
#6

Try This.

pawn Код:
if(strcmp(cmdtext, "/duty", true, 5))
{
    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, 5))
{
    // 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;
}
Reply
#7

no that still is the same , i have taken screens to show what i mean, and i will show my player command text stuff out of my gamemode.
Commands out of gamemode
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new command[130], params[130];
    if(sscanf(cmdtext, "s[128]s[128]", command, params) != 0)
    {
        sscanf(cmdtext, "s[128]", command);
    }
    if(strcmp(cmdtext, "/duty", true, 5))
{
    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, 5))
{
    // 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;
}

   

    if(!strcmp(command, "/lht", true)) //2783.2734, 2663.8027, 12.5999
    {
        if(!GetPVarInt(playerid, "LHT:IsMember")) return SendClientMessage(playerid, red, "ERROR: You are not a member of LHT!");
        if(!IsPlayerInRangeOfPoint(playerid, LHT_GATE_RANGE, 2783.2734, 2663.8027, 12.5999)) return SendClientMessage(playerid, red, "ERROR: You are not close enough to the gate!");
        if(!gatest)
        {
            SendClientMessage(playerid, red, "GATE IS NOW {ffff00}OPEN DONT FORGET TO CLOSE IT{ff0000}!");
            PlayerPlaySound(playerid, 1035, 0.0, 0.0, 0.0);
            MoveDynamicObject(lhtgate, 2783.2734, 2663.8027, 7.0249, 5.0);
            gatest = 1;
        }
        else
        {
            SendClientMessage(playerid, red, "GATE IS NOW {ffff00}CLOSED{ff0000}!");
            PlayerPlaySound(playerid, 1035, 0.0, 0.0, 0.0);
            MoveDynamicObject(lhtgate, 2783.2734, 2663.8027, 12.5999, 5.0);
            gatest = 0;
        }
        return 1;
    }

    if(!strcmp(cmdtext, "/depot"))
    {
       SetPlayerPos(playerid, 2785.8850,2646.8132,10.8363);
       SendClientMessage(playerid,red, "Welcome To{ffff00} LHT Company ");
       return 1;
    }


    if(!strcmp(command, "/rules", true))
    {
        new str[1111];
        str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
        return 1;
    }

    if(!strcmp(command, "/detach", true))
    {
        new var0 = 0;
        var0 = GetPlayerVehicleID(playerid);
        DetachTrailerFromVehicle(var0);
        SendClientMessage(playerid, 0xFF0000FF, "Your trailer is Detached!!!");
        return 1;
    }
    if(!strcmp(command, "/flip", true))
    {
        new Float:var0 = 0.0, Float:var1 = 0.0, Float:var2 = 0.0;
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetCameraBehindPlayer(playerid);
        }
        GetPlayerPos(playerid, var0, var1, var2);
        SetVehiclePos(GetPlayerVehicleID(playerid), var0, var1, var2);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
        return 1;
    }

    if(!strcmp(command, "/repair", true))
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        }
        RepairVehicle(GetPlayerVehicleID(playerid));
        SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        GivePlayerMoney(playerid, -200);
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been repaired! $200 please");
        return 1;
    }

    if(!strcmp(command, "/hy",true))
    {
        if(GetPlayerVehicleID(playerid) != 0)
        {
            new LModel = GetVehicleModel(GetPlayerVehicleID(playerid));
            switch(LModel)
            {
                case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
                return SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle!");
            }
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        }
        else
        {
            SendClientMessage(playerid, red, "ERROR: You are not in a vehicle");
        }
        return 1;
    }

    if(!strcmp(command, "/reclass", true))
    {
        ForceClassSelection(playerid);
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }

    if(!strcmp(command, "/cmds", true))
    {
        new str[1111];
        str = "{00CC00}Player Commands\n{FFFFFF}/hy,/report,/rescue,/credits,/vhelp,/hire,/refill,/cancel,/admins,/reclass\n{FFFF00}Truck Class\n{FFFFFF}/work,/detach\n{00ff00}[LHT]Company\n{FFFFFF}/depot,/lht\n{FF6600}Bus Class\n{FFFFFF}/onduty,/offduty\n{FF0000}Admin Commands\n{FFFFFF}/flip,/ban,/kick,/lspec,/slap,/warn,/lcmds,/level,/lmenu";
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Command List",str,"Ok","Back");
        return 1;
    }

    if(!strcmp(command, "/cb", true))
    {
        new name[20];
        GetPlayerName(playerid, name, sizeof(name));
        format(params, sizeof(params), "CB: %s: {ffffff}%s", name, params);
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, 0xff00ffff, params);
        }
        return 1;
    }

    if(!strcmp(command, "/credits", true))
    {
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF9900}Credits","{00FF00}Scripters:\n{FFFFFF}Bally-Opremium\n{FF0000}Mappers:\n{FFFFFF}Bally,Micheal1982\n{0000FF}Plugins:\n{FFFFFF}Sscanf-******","Ok","Back");
        return 1;
    }

    if(!strcmp("/onduty", command, true))
    {
        if(GetPlayerTeam(playerid) != 4) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not a Bus Driver!");
        if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not driving a vehicle!");
        if(GetPVarInt(playerid, "InLine") != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are already working!");
        new vid = GetPlayerVehicleID(playerid), vmod = GetVehicleModel(vid);
        if(vmod != 437) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You need a Chauufer Vehicle to complete these missions Lines!");
        new id = MRandom(sizeof(BusRoutes));
        new FStr[128];
        format(FStr, sizeof(FStr), "OBus/%d.lht", BusRoutes[id][LineID]);
        INI_ParseFile(FStr, "OnParseBusRoute", .bExtra = true, .extra = playerid, .bPassTag = true);
        SetPVarInt(playerid, "InLine", BusRoutes[id][LineID]);
        SetPVarInt(playerid, "InLineCP", 0);
        SetPVarInt(playerid, "InLineEx", id);
        SetPVarInt(playerid, "IsWorking?", 1);
        SetPlayerRaceCheckpoint(playerid, 1, GetPVarFloat(playerid, "BusRoute_0_X"), GetPVarFloat(playerid, "BusRoute_0_Y"), GetPVarFloat(playerid, "BusRoute_0_Z"), GetPVarFloat(playerid, "BusRoute_0_X"), GetPVarFloat(playerid, "BusRoute_0_Y"), GetPVarFloat(playerid, "BusRoute_0_Z"), 10.0);
        format(FStr, sizeof(FStr), "You are now working in line %d : %s", BusRoutes[id][LineID], BusRoutes[id][LineNAME]);
        SendClientMessage(playerid, 0xFFFF00AA, FStr);
        SendClientMessage(playerid, 0xFF0000AA, "Follow the marked checkpoints!");
        return 1;
    }

    if(!strcmp("/offduty", command, true))
    {
        if(GetPlayerTeam(playerid) != 4) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not a Bus Driver!");
        if(GetPVarInt(playerid, "InLine") == 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not working!");
        SetPVarInt(playerid, "InLine", 0);
        SetPVarInt(playerid, "InLineCP", 0);
        SetPVarInt(playerid, "InLineEx", 0);
        SetPVarInt(playerid, "IsWorking?", 0);
        SendClientMessage(playerid, 0xFF0000AA, "You are now off-duty!");
        DisablePlayerRaceCheckpoint(playerid);
        return 1;
    }

    if(!strcmp("/work", command, true))
    {
        if(GetPlayerTeam(playerid) != 2) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not a trucker!");
        if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not driving a vehicle!"); //Check if the player is DRIVING a vehicle, prevents missions as passenger
        if(GetPVarInt(playerid, "IsWorking?") != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are already working!");
        new vid = GetPlayerVehicleID(playerid), vmod = GetVehicleModel(vid), tid = GetVehicleTrailer(vid), tmod = GetVehicleModel(tid);
        switch(vmod)
        {
            case 403, 514, 515: //Is the player driving a Linerunner, Tanker or roadtrain?
            {
                if(tid == 0) return SendClientMessage(playerid, red, "ERROR: You need a trailer attached to do trucker missions!");
                switch(tmod)
                {
                    case 435, 591: //Is a BOX trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomBox));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
                        #endif
                        return 1; //Stops processing the code
                    }
                    case 450: //Is a DUMPER trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomDumper); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomDumper[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13343, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomDumper));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomDumper[id][LoadName], TruckingMissionRandomDumper[id][LoadPointName], TruckingMissionRandomDumper[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomDumper[id][UseTrailerCheck], TruckingMissionRandomDumper[id][MissionPay], TruckingMissionRandomDumper[id][loadx],TruckingMissionRandomDumper[id][loady], TruckingMissionRandomDumper[id][loadz], TruckingMissionRandomDumper[id][unloadx],TruckingMissionRandomDumper[id][unloady], TruckingMissionRandomDumper[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomDumper[id][MissionName]);
                        #endif
                        return 1; //Stops processing the code
                    }
                    case 584: //Is a PETRO trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomPetro); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomPetro[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13344, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomPetro));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomPetro[id][LoadName], TruckingMissionRandomPetro[id][LoadPointName], TruckingMissionRandomPetro[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomPetro[id][UseTrailerCheck], TruckingMissionRandomPetro[id][MissionPay], TruckingMissionRandomPetro[id][loadx],TruckingMissionRandomPetro[id][loady], TruckingMissionRandomPetro[id][loadz], TruckingMissionRandomPetro[id][unloadx],TruckingMissionRandomPetro[id][unloady], TruckingMissionRandomPetro[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomPetro[id][MissionName]);
                        #endif
                        return 1; //Stops processing the
                    }
                }
                return SendClientMessage(playerid, red, "ERROR: Invalid trailer"); //If no match was found in the 'switch' then the trailer type is invalid
            }
            case 578, 455, 498: //Is the player driving a DTF-30, Flatbed or Boxville?
            {
                #if defined USE_DIALOGS
                new str[1024], count, strB[111];
                new rand = count;
                for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                {
                    if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
                    {
                        format(strB, sizeof(strB), "Internal_%d_Value", count);
                        SetPVarInt(playerid, strB, i);
                        count++;
                        format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
                    }
                    SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
                }
                ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                #else
                new id = MRandom(sizeof(TruckingMissionRandomBox));
                new strB[128];
                format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
                SetPVarString(playerid, "OnMission", strB);
                CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
                SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
                #endif
                return 1; //Stops processing the code
            }
        }
        return SendClientMessage(playerid, red, "ERROR: You can't work with this vehicle"); //If no match was found in the 'switch' then the vehicle is invalid
    }

    if(!strcmp("/assistance", command, true))
    {
        if(GetPVarInt(playerid, "CalledAssistance") != 0) return SendClientMessage(playerid, red, "ERROR: You already called assistance!");
        SetPVarInt(playerid, "CalledAssistance", CreateDynamicSphere(0.0, 0.0, 0.0, 10.0, -1, -1, -1));
        AttachDynamicAreaToPlayer(GetPVarInt(playerid, "CalledAssistance"), playerid);
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "\"%s\" needs assistance... Go and help him!", str);
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == 3) SendClientMessage(i, red, str);
        }
        SendClientMessage(playerid, 0x33FF00FF, "Assistance called! {ff0000}Mechanic is on his way Please Wait here!");
    }

    if(!strcmp("/cancel", command, true) || !strcmp("/cancel", command, true))
    {
        if(GetPlayerTeam(playerid) != 2) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not a trucker!");
        if(GetPVarInt(playerid, "IsWorking?") != 0) CancelPlayersCurrentMission(playerid);
        return 1;
    }

    return 0;
}
if i type say /rules

it still gives me

so as you can see it takes over my gamemode commands.
Reply
#8

Well, looks like you attempted to use params in OnPlayerCommandText, when by default you already have cmdtext !

I've redone the whole top parts of each command (the if statements with the command names)

Try this:

pawn Код:
if(strcmp(cmdtext, "/duty", true, 5))
    {
        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;
        }
    }
    if(strcmp(cmdtext, "/fare", true, 5))
    {
        // 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;
    }
    if(strcmp(command, "/lht", true, 4)) //2783.2734, 2663.8027, 12.5999
    {
        if(!GetPVarInt(playerid, "LHT:IsMember")) return SendClientMessage(playerid, red, "ERROR: You are not a member of LHT!");
        if(!IsPlayerInRangeOfPoint(playerid, LHT_GATE_RANGE, 2783.2734, 2663.8027, 12.5999)) return SendClientMessage(playerid, red, "ERROR: You are not close enough to the gate!");
        if(!gatest)
        {
            SendClientMessage(playerid, red, "GATE IS NOW {ffff00}OPEN DONT FORGET TO CLOSE IT{ff0000}!");
            PlayerPlaySound(playerid, 1035, 0.0, 0.0, 0.0);
            MoveDynamicObject(lhtgate, 2783.2734, 2663.8027, 7.0249, 5.0);
            gatest = 1;
        }
        else
        {
            SendClientMessage(playerid, red, "GATE IS NOW {ffff00}CLOSED{ff0000}!");
            PlayerPlaySound(playerid, 1035, 0.0, 0.0, 0.0);
            MoveDynamicObject(lhtgate, 2783.2734, 2663.8027, 12.5999, 5.0);
            gatest = 0;
        }
        return 1;
    }
    if(strcmp(cmdtext, "/depot", true, 6))
    {
       SetPlayerPos(playerid, 2785.8850,2646.8132,10.8363);
       SendClientMessage(playerid,red, "Welcome To{ffff00} LHT Company ");
       return 1;
    }
    if(strcmp(cmdtext, "/rules", true, 6))
    {
        new str[1111];
        str = "{FF9900}No cheating, glitching or using any script exploit! Every cheater or bug MUST be reported by /report or on forum\nNo ramming or blocking\nNo carjacking! Locking vehicles not owned by you\nNo killing, punching, carkilling or running over\nNo Spamming\nNo flaming, racism or disrespecting other players\nNo asking for admin level";
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Server Rules",str,"Ok","Back");
        return 1;
    }
    if(strcmp(cmdtext, "/detach", true, 7))
    {
        new var0 = 0;
        var0 = GetPlayerVehicleID(playerid);
        DetachTrailerFromVehicle(var0);
        SendClientMessage(playerid, 0xFF0000FF, "Your trailer is Detached!!!");
        return 1;
    }
    if(strcmp(cmdtext, "/flip", true, 5))
    {
        new Float:var0 = 0.0, Float:var1 = 0.0, Float:var2 = 0.0;
        if(IsPlayerInAnyVehicle(playerid))
        {
            SetCameraBehindPlayer(playerid);
        }
        GetPlayerPos(playerid, var0, var1, var2);
        SetVehiclePos(GetPlayerVehicleID(playerid), var0, var1, var2);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
        return 1;
    }
    if(strcmp(cmdtext, "/repair", true, 7))
    {
        if(!IsPlayerInAnyVehicle(playerid))
        {
            return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        }
        RepairVehicle(GetPlayerVehicleID(playerid));
        SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
        PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        GivePlayerMoney(playerid, -200);
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been repaired! $200 please");
        return 1;
    }
    if(strcmp(cmdtext, "/hy", true, 3))
    {
        if(GetPlayerVehicleID(playerid) != 0)
        {
            new LModel = GetVehicleModel(GetPlayerVehicleID(playerid));
            switch(LModel)
            {
                case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
                return SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle!");
            }
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
            PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        }
        else
        {
            SendClientMessage(playerid, red, "ERROR: You are not in a vehicle");
        }
        return 1;
    }
    if(strcmp(cmdtext, "/reclass", true, 8))
    {
        ForceClassSelection(playerid);
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
    if(strcmp(cmdtext, "/cmds", true, 5))
    {
        new str[1111];
        str = "{00CC00}Player Commands\n{FFFFFF}/hy,/report,/rescue,/credits,/vhelp,/hire,/refill,/cancel,/admins,/reclass\n{FFFF00}Truck Class\n{FFFFFF}/work,/detach\n{00ff00}[LHT]Company\n{FFFFFF}/depot,/lht\n{FF6600}Bus Class\n{FFFFFF}/onduty,/offduty\n{FF0000}Admin Commands\n{FFFFFF}/flip,/ban,/kick,/lspec,/slap,/warn,/lcmds,/level,/lmenu";
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF0000}Command List",str,"Ok","Back");
        return 1;
    }
    if(strcmp(cmdtext, "/cb", true, 3))
    {
        new name[20];
        GetPlayerName(playerid, name, sizeof(name));
        format(params, sizeof(params), "CB: %s: {ffffff}%s", name, params);
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == GetPlayerTeam(playerid)) SendClientMessage(i, 0xff00ffff, params);
        }
        return 1;
    }
    if(strcmp(cmdtext, "/credits", true, 8))
    {
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"{FF9900}Credits","{00FF00}Scripters:\n{FFFFFF}Bally-Opremium\n{FF0000}Mappers:\n{FFFFFF}Bally,Micheal1982\n{0000FF}Plugins:\n{FFFFFF}Sscanf-******","Ok","Back");
        return 1;
    }
    if(strcmp(cmdtext, "/onduty", true, 7))
    {
        if(GetPlayerTeam(playerid) != 4) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not a Bus Driver!");
        if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not driving a vehicle!");
        if(GetPVarInt(playerid, "InLine") != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are already working!");
        new vid = GetPlayerVehicleID(playerid), vmod = GetVehicleModel(vid);
        if(vmod != 437) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You need a Chauufer Vehicle to complete these missions Lines!");
        new id = MRandom(sizeof(BusRoutes));
        new FStr[128];
        format(FStr, sizeof(FStr), "OBus/%d.lht", BusRoutes[id][LineID]);
        INI_ParseFile(FStr, "OnParseBusRoute", .bExtra = true, .extra = playerid, .bPassTag = true);
        SetPVarInt(playerid, "InLine", BusRoutes[id][LineID]);
        SetPVarInt(playerid, "InLineCP", 0);
        SetPVarInt(playerid, "InLineEx", id);
        SetPVarInt(playerid, "IsWorking?", 1);
        SetPlayerRaceCheckpoint(playerid, 1, GetPVarFloat(playerid, "BusRoute_0_X"), GetPVarFloat(playerid, "BusRoute_0_Y"), GetPVarFloat(playerid, "BusRoute_0_Z"), GetPVarFloat(playerid, "BusRoute_0_X"), GetPVarFloat(playerid, "BusRoute_0_Y"), GetPVarFloat(playerid, "BusRoute_0_Z"), 10.0);
        format(FStr, sizeof(FStr), "You are now working in line %d : %s", BusRoutes[id][LineID], BusRoutes[id][LineNAME]);
        SendClientMessage(playerid, 0xFFFF00AA, FStr);
        SendClientMessage(playerid, 0xFF0000AA, "Follow the marked checkpoints!");
        return 1;
    }
    if(strcmp(cmdtext,"/offduty", true, 8))
    {
        if(GetPlayerTeam(playerid) != 4) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You are not a Bus Driver!");
        if(GetPVarInt(playerid, "InLine") == 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not working!");
        SetPVarInt(playerid, "InLine", 0);
        SetPVarInt(playerid, "InLineCP", 0);
        SetPVarInt(playerid, "InLineEx", 0);
        SetPVarInt(playerid, "IsWorking?", 0);
        SendClientMessage(playerid, 0xFF0000AA, "You are now off-duty!");
        DisablePlayerRaceCheckpoint(playerid);
        return 1;
    }
    if(strcmp(cmdtext,"/work", true, 5))
    {
        if(GetPlayerTeam(playerid) != 2) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not a trucker!");
        if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not driving a vehicle!"); //Check if the player is DRIVING a vehicle, prevents missions as passenger
        if(GetPVarInt(playerid, "IsWorking?") != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are already working!");
        new vid = GetPlayerVehicleID(playerid), vmod = GetVehicleModel(vid), tid = GetVehicleTrailer(vid), tmod = GetVehicleModel(tid);
        switch(vmod)
        {
            case 403, 514, 515: //Is the player driving a Linerunner, Tanker or roadtrain?
            {
                if(tid == 0) return SendClientMessage(playerid, red, "ERROR: You need a trailer attached to do trucker missions!");
                switch(tmod)
                {
                    case 435, 591: //Is a BOX trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomBox));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
                        #endif
                        return 1; //Stops processing the code
                    }
                    case 450: //Is a DUMPER trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomDumper); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomDumper[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13343, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomDumper));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomDumper[id][LoadName], TruckingMissionRandomDumper[id][LoadPointName], TruckingMissionRandomDumper[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomDumper[id][UseTrailerCheck], TruckingMissionRandomDumper[id][MissionPay], TruckingMissionRandomDumper[id][loadx],TruckingMissionRandomDumper[id][loady], TruckingMissionRandomDumper[id][loadz], TruckingMissionRandomDumper[id][unloadx],TruckingMissionRandomDumper[id][unloady], TruckingMissionRandomDumper[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomDumper[id][MissionName]);
                        #endif
                        return 1; //Stops processing the code
                    }
                    case 584: //Is a PETRO trailer?
                    {
                        #if defined USE_DIALOGS
                        new str[1024], count, strB[111];
                        new rand = count;
                        for(new i; i < sizeof(TruckingMissionRandomPetro); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                        {
                            if(GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName]) == 0)
                            {
                                format(strB, sizeof(strB), "Internal_%d_Value", count);
                                SetPVarInt(playerid, strB, i);
                                count++;
                                format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomPetro[rand][LoadName]);
                            }
                            SetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName])+1);
                        }
                        ShowPlayerDialog(playerid, 13344, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                        #else
                        new id = MRandom(sizeof(TruckingMissionRandomPetro));
                        new strB[128];
                        format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomPetro[id][LoadName], TruckingMissionRandomPetro[id][LoadPointName], TruckingMissionRandomPetro[id][UnloadPointName]);
                        SetPVarString(playerid, "OnMission", strB);
                        CreatePlayerMission(playerid, TruckingMissionRandomPetro[id][UseTrailerCheck], TruckingMissionRandomPetro[id][MissionPay], TruckingMissionRandomPetro[id][loadx],TruckingMissionRandomPetro[id][loady], TruckingMissionRandomPetro[id][loadz], TruckingMissionRandomPetro[id][unloadx],TruckingMissionRandomPetro[id][unloady], TruckingMissionRandomPetro[id][unloadz]);
                        SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                        SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomPetro[id][MissionName]);
                        #endif
                        return 1; //Stops processing the
                    }
                }
                return SendClientMessage(playerid, red, "ERROR: Invalid trailer"); //If no match was found in the 'switch' then the trailer type is invalid
            }
            case 578, 455, 498: //Is the player driving a DTF-30, Flatbed or Boxville?
            {
                #if defined USE_DIALOGS
                new str[1024], count, strB[111];
                new rand = count;
                for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
                {
                    if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
                    {
                        format(strB, sizeof(strB), "Internal_%d_Value", count);
                        SetPVarInt(playerid, strB, i);
                        count++;
                        format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
                    }
                    SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
                }
                ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
                #else
                new id = MRandom(sizeof(TruckingMissionRandomBox));
                new strB[128];
                format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
                SetPVarString(playerid, "OnMission", strB);
                CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
                SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
                SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
                #endif
                return 1; //Stops processing the code
            }
        }
        return SendClientMessage(playerid, red, "ERROR: You can't work with this vehicle"); //If no match was found in the 'switch' then the vehicle is invalid
    }
    if(strcmp(cmdtext,"/assistance", true, 11))
    {
        if(GetPVarInt(playerid, "CalledAssistance") != 0) return SendClientMessage(playerid, red, "ERROR: You already called assistance!");
        SetPVarInt(playerid, "CalledAssistance", CreateDynamicSphere(0.0, 0.0, 0.0, 10.0, -1, -1, -1));
        AttachDynamicAreaToPlayer(GetPVarInt(playerid, "CalledAssistance"), playerid);
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "\"%s\" needs assistance... Go and help him!", str);
        for(new i; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerTeam(i) == 3) SendClientMessage(i, red, str);
        }
        SendClientMessage(playerid, 0x33FF00FF, "Assistance called! {ff0000}Mechanic is on his way Please Wait here!");
    }
    if(strcmp(cmdtext, "/cancel", true, 7))
    {
        if(GetPlayerTeam(playerid) != 2) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not a trucker!");
        if(GetPVarInt(playerid, "IsWorking?") != 0) CancelPlayersCurrentMission(playerid);
        return 1;
    }
    return 0;
}
Reply
#9

Ah man, I just looked at the first line of your code, and I immediately figured out what your problem is: strcmp returns 0 when the strings are the same!

pawn Код:
if(!strcmp(cmdtext, "/duty", true))
Reply
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
Ah man, I just looked at the first line of your code, and I immediately figured out what your problem is: strcmp returns 0 when the strings are the same!

pawn Код:
if(!strcmp(cmdtext, "/duty", true))
so i need it to be
pawn Код:
if(!strcmp(cmdtext, "/duty", false))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)