problem with some commands with ZCMD -
wallen - 28.02.2018
i got that simple command
PHP код:
CMD:kill(playerid, params[])
{
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
SetPlayerHealth(playerid, 0);
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.??
Re: problem with some commands with ZCMD -
Sew_Sumi - 28.02.2018
Don't need params if you aren't going to use them.
Re: problem with some commands with ZCMD -
wallen - 28.02.2018
still that issue
Re: problem with some commands with ZCMD -
Fratello - 28.02.2018
Do you have OnPlayerCommandReceive callback?
Re: problem with some commands with ZCMD -
wallen - 28.02.2018
did that
PHP код:
CMD:kill(playerid)
{
printf ("starting the cmd");
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
SetPlayerHealth(playerid, 0);
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(playerid, cmdtext[], 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(playerid, cmdtext[])
{
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
Re: problem with some commands with ZCMD -
Fratello - 28.02.2018
https://sampforum.blast.hk/showthread.php?tid=523806
Re: problem with some commands with ZCMD -
ISmokezU - 28.02.2018
I think if you remove the if statement it should work. Give it a try.
Re: problem with some commands with ZCMD -
Hunud - 28.02.2018
I think OnPlayerCommandPerformed should return 0 for the unknown command only.