Oke this is starting to piss me off!
#1

Hey ik got my own server but when i wanted to do a comand such as /kill or any other command it said "server: Unkown command."
Oke fine i couldnt fix it sow i started a new GM, guess what? Somehow it just started again!

Does anyone know the cause/solution?

-Thanks in advance.
Reply
#2

Have you got

pawn Код:
return 1;
? :3
Reply
#3

is any OnPlayerCommandText() returning 1; in any filterscript? if so, it will disable the gamemodes' callback. remove the return 1;'s from your filterscripts' OPCT() and try all your gamemode-commands for funcitonality (w/o any FS loaded).
@getty: i bet each command contains the return 1; at its end ^^
Reply
#4

I dont have any FS loaded.
Reply
#5

Well, that's strange ...
But still you must have this:
pawn Код:
public OnPlayerCommandText()
{
     return 1;
}
Reply
#6

This is what i have:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[128];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayerid, moneys, idx;
    new giveplayer[MAX_PLAYER_NAME];
    new cmd[256];
    new tmp[256];
    new Message[256];
    new gMessage[256];
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
    cmd = strtok(cmdtext, idx);
    if(strcmp("/pm", cmd, true))
    {
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp) || strlen(tmp) > 5) {
            SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
            return 1;
        }
        new id = strval(tmp);
        gMessage = strrest(cmdtext,idx);
        if(!strlen(gMessage)) {
            SendClientMessage(playerid,COLOR_YELLOW,"Usage: /pm (id) (message)");
            return 1;
        }
        if(!IsPlayerConnected(id)) {
            SendClientMessage(playerid,COLOR_YELLOW,"/pm : Bad player ID");
            return 1;
        }
        if(playerid != id) {
            GetPlayerName(id,iName,sizeof(iName));
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
            SendClientMessage(playerid,COLOR_ORANGE,Message);
            format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
            SendClientMessage(id,COLOR_YELLOW,Message);
            printf("PM: %s",Message);
        }
        else {
            SendClientMessage(playerid,COLOR_YELLOW,"You cannot PM yourself");
        }
        return 1;
    }
// The rule commands always handy, change it to your needs if needed.
    if(!strcmp("/refuel",cmdtext,true))
     {
     if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return SendClientMessage(playerid,0xFF0000FF,"[ERROR:] {FFFFFF}You are not driving a vehicle.");
     if(!IsAValidVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,0xFF0000FF,"[ERROR:] {FFFFFF}This type of vehicle does not need to be refilled with fuel");
     if(!Tank[playerid]) return SendClientMessage(playerid,0xFF0000FF,"[ERROR:] {FFFFFF}You have no tank to refuel the vehicle");
     Tank[playerid]--;
     VFuel[GetPlayerVehicleID(playerid)]+=10;
     SendClientMessage(playerid,0x00FF00FF,"[VEHICLE:] {FFFFFF}You refilled successfully your vehicle.");
     return 1;
     }
    if (strcmp("/rules", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_SLATEGRAY, "Please choose an kind of a /rule [catagory] :");
        SendClientMessage(playerid, COLOR_SLATEGRAY, "RP, OOC, vehicle, TIPS.");
        return 1;
    }
    if (strcmp("/rules RP", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_IVORY, "RP RULES:");
        SendClientMessage(playerid, COLOR_IVORY, "Dont metagame, dont powergame, dont do anything you would not do in REALLFE.");
        SendClientMessage(playerid, COLOR_IVORY, "Dont swim in normal clothes only in swimming clothes.");
        SendClientMessage(playerid, COLOR_IVORY, "Dont make advertisment like: 'Selling my awsome great power guns!' this wil result into a temp.ban.");
        SendClientMessage(playerid, COLOR_IVORY, "Dont OOC talk in IC chat, this wil result into a temp.ban.");
        SendClientMessage(playerid, COLOR_IVORY, "Dont use /n like this: 'can anyone who is selling guns /pm me????' this wil result into a ban as it is MG(metagame).");
        SendClientMessage(playerid, COLOR_IVORY, "If you do not listen to these rules you will get an ban/adminjail/temp ban.");
        return 1;
    }
    if (strcmp("/rules OOC", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_GREENYELLOW, "OOC RULES:");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont powergame, dont whine about anything! because you may get reported.");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Only use /o to congratulate a new admin or for purposes an admin wil allow(he will tell it on /o otherwise dont /pm him to ask.");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont use /b to ask people if they want to buy something of you, this can be anything from vehicles to drugs, houes, guns, melee weapons.");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont IC talk in OOC chat, this may result into a confusion to the other player.");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont whine about an ajail, you may pm the admin that ajailed you with prove");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont use /n like this: ""Can everyone /report [id] this and this person??"" this wil result into a ban as it is MG(metagame).");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "Dont use /n like this: '""Why are the admin such losers?""also thi wil result into a ban, why?,to obvious");
        SendClientMessage(playerid, COLOR_GREENYELLOW, "If you do not listen to these rules you will get an ban/adminjail/temp ban.");
        return 1;
    }
    if (strcmp("/rules vehicle", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_NAVAJOWHITE, "Vehicle RULES:");
        SendClientMessage(playerid, COLOR_NAVAJOWHITE, "Dont offroad without an offroad vehicle, and even when you do, you HAVE to drive slower then 65mph.");
        SendClientMessage(playerid, COLOR_NAVAJOWHITE, "Sell your vehicle RPly, how?, /tips selling");
        SendClientMessage(playerid, COLOR_NAVAJOWHITE, "Repair your vehicle RPly, how?, /tips how to repair.");
        SendClientMessage(playerid, COLOR_NAVAJOWHITE, "Only car surf in the back of an: Sadler, Yosemite, Savana, Walton, Bobcat, Feltzer, , every boat, and only with admin permission: wings of a dodo.");
        return 1;
    }
    if (strcmp("/tips", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Farm life RP tip catagory's:");
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Vehicle, Selling, Police situation, Robbing, rulebreakers.");
        SendClientMessage(playerid, COLOR_YELLOWGREEN, "Aditional info: [USAGE]/tips [catagory]");
        return 1;
    }
    if (strcmp("/tips vehicle", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_BLANCHEDALMOND, "Farm life RP vehicle tips:");
        SendClientMessage(playerid, COLOR_BLANCHEDALMOND, "How to park: 2 wheels on the road 2 wheels on the sidewalk, make sure that you dont have to turn when you want to drive away.");
        SendClientMessage(playerid, COLOR_BLANCHEDALMOND, "How to make a turn: Do not turn in the midle of the road just take the corners and drive around via the streets(this is more of a rule).");
        SendClientMessage(playerid, COLOR_BLANCHEDALMOND, "How to offroad: Only drive 65MPH because if you get reported for driving to fast an admin will spectate and rate how fast you go and maybe tel you to slow down.");
        SendClientMessage(playerid, COLOR_BLANCHEDALMOND, "How to carsurf: Use the sit anim(/gro) or the lay anim(/lay(2)), if you go for the Dodo one you need an RP reason because otherwise the admin wil say no.");
        return 1;
    }
    if (strcmp("/tips SELLING", cmdtext, true))
    {
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "Farm life RP selling tips:");
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "How not to get scammed: Dont trade like /pay and /give, use /sell instead.");
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "How to get an buyer: Do not do like ''/b who wants to buy a buffalo!'' instead do this: ''/s who would like to buy a buffalo!''.");
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "How to get an seller: Just like the buyer use /s.");
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "How to sell your drugs properly: Go to a potential buyer and do /w [id] ey sir you need some grass or sugar?.");
        SendClientMessage(playerid, COLOR_DARKGOLDENROD, "How to sell your guns properly: Go to an potential buyer and say: ''Ey you look like you can use some protection, in need of some?''");
        return 1;
    }
    if (strcmp("/kill", cmdtext, true))
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
// This is to test the tutorial of the server, when the register system is ready this will be unesecary.
    if (strcmp("/tut", cmdtext, true))
    {
    Timer0 = SetTimerEx("tut0",25000,false, "i", playerid);
    return 1;
    }
    if(strcmp("/eoff", cmdtext, true)) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
            SendClientMessage(playerid, COLOR_DARKVIOLET, "Engine turned [OFF]");
        }
        return 1;
    }
    if(strcmp("/loff",cmdtext, true)) {
    new vid = GetPlayerVehicleID(playerid);
    if(vid != INVALID_VEHICLE_ID) {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid, COLOR_GREEN, "Lights turned [OFF]");
    }
    return 1;
    }
    if(strcmp("/openhood",cmdtext, true)) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
        }
        return 1;
    }
    if(strcmp("/closehood",cmdtext, true)) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
        }
        return 1;
    }
    if(strcmp("/opentrunk",cmdtext, true)) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
        }
        return 1;
    }
    if(strcmp("/closetrunk",cmdtext, true)) {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID) {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
        }
        return 1;
    }
// Not recommended to use these as they were to test some functions(just remove these lines).
    if(strcmp("/backpack",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 3026, 1, -0.135905, -0.035217, -0.004736, 0.000000, 0.000000, 0.000000, 0.938511, 1.195391, 1.403976 );
    return 1;
    }
    if(strcmp("/toilet",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 3504, 9, -1.680682, -0.035217, 0.085574, 120.201538, 269.855957, 0.000000, 0.938511, 1.059731, 1.403976 ); // vgsN_portaloo - i'm on the toilet
    return 1;
    }
    if(strcmp("/caravan",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 3175, 1, 1.800549, -7.936491, -0.562830, 274.198608, 68.348548, 85.282478, 0.996033, 1.000000, 1.000000 );
    return 1;
    }
    if(strcmp("/celebtows",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 2773, 1, -0.686773, 1.300720, 0.048567, 230.873947, 93.386009, 44.651622, 1.056300, 1.195770, 1.109045 ); // CJ_AIRPRT_BAR - stay behind the red tow
    SetPlayerAttachedObject( playerid, 1, 2773, 1, -0.686773, 0.124766, 1.247365, 228.908691, 93.386009, 314.812225, 1.056300, 1.195770, 1.109045 ); // CJ_AIRPRT_BAR - stay behind the red tow
    SetPlayerAttachedObject( playerid, 2, 2773, 1, -0.686773, 0.124766, -1.121676, 228.908691, 93.386009, 314.812225, 1.056300, 1.195770, 1.109045 ); // CJ_AIRPRT_BAR - stay behind the red tow
    return 1;
    }
    if(strcmp("/phonesuit",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 3, 1346, 14, -0.017170, -0.091076, 0.163037, 324.529083, 261.702697, 167.653457, 0.551044, 0.890761, 1.000000 ); // CJ_PHONE_KIOSK2 - cant you see that i'm on the phone!
    return 1;
    }
    if(strcmp("/targetface",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 4, 2049, 1, 0.146496, 0.296781, 0.034521, 3.474960, 84.343170, 183.955520, 1.056300, 1.195770, 1.109045 ); // CJ_TARGET1 - target:please dont shoot!    }
    return 1;
    }
    if(strcmp("/noodlejob",cmdtext, true)) {
    SetPlayerAttachedObject(playerid, 0, 1570, 1, 0.009888, 0.856225, 0.232861, 43.402328, 84.025131, 129.846206, 1.056300, 1.195770, 1.109045);
    SetPlayerAttachedObject(playerid, 1, 2839, 1, -0.404478, 1.077121, 0.000000, 263.004364, 65.316986, 349.609008, 1.000000, 1.000000, 1.000000 ); // GB_takeaway04 - noodle food(correct one
    SetPlayerAttachedObject(playerid, 2, 2858, 1, -0.404478, 1.042391, -1.035512, 263.004364, 65.316986, 349.609008, 1.000000, 1.000000, 1.000000 ); // gb_kitchtakeway03 - noodle food(correct one
    return 1;
    }
    if(strcmp("/readyforwar",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 5, 2064, 1, -0.547271, 0.562147, -0.633240, 356.020660, 84.343170, 183.955520, 1.056300, 1.195770, 1.109045 ); // CJ_FEILDGUN - dont screw with meh!
    return 1;
    }
    if(strcmp("/tredmill",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 5, 2627, 1, -1.241810, -0.072407, -0.061079, 178.782867, 93.116790, 183.955520, 1.056300, 1.195770, 1.109045 ); // gym_treadmill - gotta train
    return 1;
    }
    if(strcmp("/bigfatfart",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 2415, 1, -4.309469, 0.408157, -0.266614, 356.020660, 84.343170, 183.955520, 1.056300, 1.195770, 1.109045 ); // CJ_FF_FRYER - oops i farted
    return 1;
    }
    if(strcmp("/removeobjects",cmdtext, true)) {
    RemoveHoldingObjects(playerid);
    return 1;
    }
    if(strcmp("/creditcard",cmdtext, true)) {
    SetPlayerAttachedObject(playerid, 0, 1581, 6, 0.1, 0, 0, 0, 90, 0, 0.2, 0.2, 0.2);
    return 1;
    }
    if(strcmp("/shopping",cmdtext, true)) {
    SetPlayerAttachedObject( playerid, 0, 1349, 14, 0.810831, -0.646524, 0.152762, 323.997863, 261.579223, 220.914367, 0.551044, 0.890761, 1.000000 ); // CJ_SHTROLLY - shopping    return 1;
    return 1;
    }
    if(strcmp(cmd, "/pay", true)) {

        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        if (IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            if (moneys > 0 && playermoney >= moneys) {
                GivePlayerMoney(playerid, (0 - moneys));
                GivePlayerMoney(giveplayerid, moneys);
                format(string, sizeof(string), "You have sent %s(ID: %d), $%d.", giveplayer,giveplayerid, moneys);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                format(string, sizeof(string), "You have recieved $%d from %s(ID: %d).", moneys, sendername, playerid);
                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                printf("%s(playerid:%d) has transfered %d to %s(ID:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            }
            else {
                SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
            }
        }
        else {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);
            }
        return 1;
    }
    return 0;
}
And i dont see anything wrong here.
Reply
#7

The last return on your callback probably needs to be "return 1;" instead of 0;
Not sure if it's gonna solve it, but worth a try
Reply
#8

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
The last return on your callback probably needs to be "return 1;" instead of 0;
Not sure if it's gonna solve it, but worth a try
Yes + Why are you still using strcmp :O
Reply
#9

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Yes + Why are you still using strcmp :O
This does not have anything to do with the problem. Everyone can use strtok because it's not a plague at all. It's not the best sollution, but many people cry pretty hard about it when they see someone using it. Also this does not solve the problem due to the fact that it will say nothing when the command does not exist. It MUST return zero in the end, there is no other possibility if you don't want your server to get fucked up.

Now to your problem:

I'm pretty sure it has to do something with that:

pawn Код:
if(blabla==1){
     do this do that... //with return
     return 1;
}
else{
    do this do that... //forgot return
}
Look up your whole code and i'm sure youll find smth.
Reply
#10

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
This does not have anything to do with the problem. Everyone can use strtok because it's not a plague at all. It's not the best sollution, but many people cry pretty hard about it when they see someone using it. Also this does not solve the problem due to the fact that it will say nothing when the command does not exist. It MUST return zero in the end, there is no other possibility if you don't want your server to get fucked up.

Now to your problem:

I'm pretty sure it has to do something with that:

pawn Код:
if(blabla==1){
     do this do that... //with return
     return 1;
}
else{
    do this do that... //forgot return
}
Look up your whole code and i'm sure youll find smth.
Huh ? i don't think a if statement should have a return ... or else it's really slow ?!

The solution is just the 'return 0' at the end ... it must be return 1;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)