PDA

View Full Version : Unknown Command [REP+]


Don_Cage
26/12/2013, 12:32 AM
Hello, i have problem i dont know whats wrong with this command when i try to /loadheroin in my truck it's say
SERVER: Unknown Command
And when i compile everything is fine



if(strcmp(cmd, "/loadheroin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
return 1;
}
}

}
return 1;
}

Loot
26/12/2013, 01:37 AM
I don't know what is the purpose of the enum PlayerHaul, but I believe it has something to do with players?

if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])


if(PlayerHaul[playerid][pHeroin] < PlayerHaul[playerid][pCapasity])

Don_Cage
26/12/2013, 01:49 AM
I don't know what is the purpose of the enum PlayerHaul, but I believe it has something to do with players?

if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])


if(PlayerHaul[playerid][pHeroin] < PlayerHaul[playerid][pCapasity])

Same thing, when im away or in other veh its say its not valid veh or right place,but when veh is right and place then say unknown command



Its for heroin,materials,iron


enum pHaul
{
pCapasity,
pMaterials,
pHeroin,
pIron,
pLoad,
};

new PlayerHaul[113][pHaul];

ToiletDuck
26/12/2013, 02:09 AM
if(strcmp(cmd, "/loadheroin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
}
}

}
return 1;
}

Don_Cage
26/12/2013, 02:21 AM
if(strcmp(cmd, "/loadheroin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
}
}

}
return 1;
}
Still same

ToiletDuck
26/12/2013, 02:28 AM
Still same

if you use the command it says unknown CMD?

Don_Cage
26/12/2013, 02:31 AM
if you use the command it says unknown CMD?

Yes,when i write wrong command on my server it should be message like it is always

The command you are trying to use is not part of our server

And only on this command SERVER: Unknown Command and yea still same unknown command with your code

Raisingz
26/12/2013, 02:58 AM
No errors were given in runtime? Try checking your log

Don_Cage
26/12/2013, 03:01 AM
No errors were given in runtime? Try checking your log

As i said no errors

Raisingz
26/12/2013, 03:03 AM
Not having a clue, first though...
Is it "if(strcmp(cmd, "/loadheroin", true) == 0)" or "if(strcmp(cmdtext, "/loadheroin", true) == 0)"
?

EDIT: nvm that's stupid, since ti gives you the wrong message if you're in an incorrect vehicle..

Zex Tan
26/12/2013, 04:39 AM
Did you have ZCMD loaded on your script? From what you said:


The command you are trying to use is not part of our server


That shows that you're using ZCMD at OnPlayerCommandPerformed (whatever the callback is named), so that means you're using a custom made message when a player enters and invalid command. OnPlayerCommandText is not supported with ZCMD because it is already modified.

KyleSta123
26/12/2013, 05:04 AM
Yeah dude, I dont think its your command its self, those lines look ok from what I can tell..
It would be something on the includes or server side of things. Are you using the right gamemode? make sure your using the right script o.O

Don_Cage
26/12/2013, 03:29 PM
I dont use zcmd, only in that command is problem it wont load heroin and will show unknown command....
Anyone else?

[WA]iRonan
26/12/2013, 03:32 PM
You should try ZCMD, trust me. It's also easier to create commands than this.


CMD:loadheroin(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
return 1;
}
}

}
return 1;
}

Don_Cage
26/12/2013, 03:39 PM
iRonan;2835576']You should try ZCMD, trust me. It's also easier to create commands than this.


CMD:loadheroin(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
return 1;
}
}

}
return 1;
}


I know,but as i said i dont use zcmd i have alot commands and i dont have time to rewrite them but in future i willing to do it.