problem with some commands with ZCMD
#1

i got that simple command

PHP код:
CMD:kill(playeridparams[])
{
     if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
     
SetPlayerHealth(playerid0);
     
SendClientMessage(playerid, -1"{c3c3c3}(INFO) You have killed yourself! (-8 points, -50 respect lost!)");
     
pInfo[playerid][Deaths]  += 1;
     
pInfo[playerid][Points]  -= 8;
     
pInfo[playerid][Respect] -= 50;
     return 
1;

But somehow, the command works, but when i write it and suddenly run it, it shows "Unknown Command" etc, like its unknown but actually not.??
Reply
#2

Don't need params if you aren't going to use them.
Reply
#3

still that issue
Reply
#4

Do you have OnPlayerCommandReceive callback?
Reply
#5

did that
PHP код:
CMD:kill(playerid)
{
     
printf ("starting the cmd");
     if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
     
SetPlayerHealth(playerid0);
     
printf ("setting hp health to 0");
     
SendClientMessage(playerid, -1"{c3c3c3}(INFO) You have killed yourself! (-8 points, -50 respect lost!)");
     
printf ("adding some loses to player config file");
     
pInfo[playerid][Deaths]  += 1;
     
pInfo[playerid][Points]  -= 8;
     
pInfo[playerid][Respect] -= 50;
     return 
1;

I see only printf ("starting the cmd"); on server dos

EDIT:

Quote:
Originally Posted by Fratello
Посмотреть сообщение
Do you have OnPlayerCommandReceive callback?
I dont have it

EDIT: yes

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
connected[playerid] == true) return SendClientMessage(playerid, -1"{c3c3c3}* You can't use any commands right now, spawn first..");
    if(!
success) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) Unknown command type /cmds to list all available commands");
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
  if(
InArena1[playerid] && strcmp(cmdtext,"/aleave",true) != 0)
  {
     
SendClientMessage(playerid, -1"{c3c3c3}(INFO) You can't use commands in the arena! (/aleave)");
     return 
0;
  }
  if(
InArena2[playerid] && strcmp(cmdtext,"/aleave",true) != 0)
  {
     
SendClientMessage(playerid, -1"{c3c3c3}(INFO) You can't use commands in the arena! (/aleave)");
     return 
0;
  }
  if(
IsPlayerInLobby[playerid] && strcmp(cmdtext,"/back",true) != 0)
  {
     
SendClientMessage(playerid, -1"{c3c3c3}(INFO) You can't use any commands in lobby! (/back)");
     return 
0;
  }
  return 
1;

Included on player command performed and received
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=523806
Reply
#7

I think if you remove the if statement it should work. Give it a try.
Reply
#8

I think OnPlayerCommandPerformed should return 0 for the unknown command only.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)