SA-MP Forums Archive
ZCMD wont recognize command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ZCMD wont recognize command (/showthread.php?tid=552126)



ZCMD wont recognize command - Type-R - 22.12.2014

Hi guys, well my friend created a little PVP filterscript. It worked fine, when a ran it with GrandLarceny. I put the filterscript in my server and it started not recognizing commands. When i use /pvp, it will only respond when i dont put player ID, or the right cash amount it will send a message back. If i put the right amounts, it will tell me Command not found. Heres the CMD:

pawn Код:
CMD:pvp(playerid, params[]){
#pragma unused params
new kID[24], String[150], money[7];
GetPlayerName(playerid, kID, MAX_PLAYER_NAME);
if(sscanf(params,"ui",pID,money)) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}/PVP [Юaidejo nick/ID] [Suma]");
if(GetPlayerMoney(playerid) < money[playerid]) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}Jыs neturite tiek pinigш!");
if(GetPVarInt(playerid, "pvpmode") == 1) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}Jыs dabar esate PVP kovoje!");
format(String,sizeof(String),"{FF1E40}[FunZoneLT]>> {FFFFFF}%s jus kvieиia PVP kovai, suma {00FF00}%i $. {FFFFFF}Norint sutikti raрykite {FF1E40}/psutikti %i",kID,money,playerid);
SendClientMessage(pID, -1, String);
format(String,sizeof(String),"{FF1E40}[FunZoneLT]>> {FFFFFF}Norint atsisakyti raрykite {FF0000}/patsaukti %i",playerid);
SendClientMessage(pID, -1, String);

//Vars
pvpinfo[playerid][ITP] = 1;
pvpinfo[pID][Invited]=1;
pvpinfo[playerid][invID] = pID;
SetPVarInt(playerid, "wmoney", money[playerid]);
SetPVarInt(pID, "wmoney", money[playerid]);
return 1;
}
Anyone know what it could be?


Re: ZCMD wont recognize command - Threshold - 23.12.2014

pawn Код:
CMD:pvp(playerid, params[])
{
    new pID, money;
    if(sscanf(params, "ui", pID, money)) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}/PVP [Юaidejo nick/ID] [Suma]");
    if(!IsPlayerConnected(pID) || pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not connected.");
    if(GetPlayerMoney(playerid) < money || !money) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}Jыs neturite tiek pinigш!");
    if(GetPVarInt(playerid, "pvpmode") == 1) return SendClientMessage(playerid, -1, "{FF1E40}[FunZoneLT]>> {FFFFFF}Jыs dabar esate PVP kovoje!");
    new String[110], kID[MAX_PLAYER_NAME];
    GetPlayerName(playerid, kID, sizeof(kID));
    format(String, sizeof(String), "{FF1E40}[FunZoneLT]>> {FFFFFF}%s jus kvieиia PVP kovai, suma {00FF00}%i $.", kID, money);
    SendClientMessage(pID, -1, String);
    format(String, sizeof(String), "Norint sutikti raрykite {FF1E40}/psutikti %i", playerid);
    SendClientMessage(pID, -1, String);
    format(String, sizeof(String), "{FF1E40}[FunZoneLT]>> {FFFFFF}Norint atsisakyti raрykite {FF0000}/patsaukti %i", playerid);
    SendClientMessage(pID, -1, String);

    //Vars
    pvpinfo[playerid][ITP] = 1;
    pvpinfo[pID][Invited] = 1;
    pvpinfo[playerid][invID] = pID;
    SetPVarInt(playerid, "wmoney", money);
    SetPVarInt(pID, "wmoney", money);
    return 1;
}
It's possible that you were getting an 'array out of bounds' error from this command, causing it to not function properly. Install the crashdetect plugin for future reference on these sorts of strange occurrences. pID was probably an INVALID_PLAYER_ID (65535) or because you were using an array size of [7] for 'money' for some reason... if the player's ID was greater than 6, it would have also crashed the command/server when you tried to access 'money[playerid]'.


Re: ZCMD wont recognize command - Type-R - 23.12.2014

Thanks, now this part works perfectly fine. Now i got an issue with the dialog, when a person accepts the duel, the a dialog appears for you to select a weapon and then it should give you guns and another dialog should appear, to let you pick the duel area. Well it works, when i run it only with gamemode, but when i do it on my regular server the dialog appears to choose guns, and when i select an option, the dialog just dissappears and nothing happens. Heres the code:

DialogResponse:
pawn Код:
if(dialogid == GunDialog)
{
if(!response) { return 1; }
if(response){
if(listitem == 0)
{
GivePlayerWeapon(playerid, 24, 50);
GivePlayerWeapon(playerid, 25, 50);
GivePlayerWeapon(pvpinfo[pID][invID], 24, 50);
GivePlayerWeapon(pvpinfo[pID][invID], 25, 50);
ShowPlayerZoneDialog(playerid);
}
if(listitem == 1)
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(pvpinfo[pID][invID], 24, 100);
GivePlayerWeapon(playerid, 31, 100);
GivePlayerWeapon(pvpinfo[pID][invID], 31, 100);
ShowPlayerZoneDialog(playerid);
}
if(listitem == 2)
{
GivePlayerWeapon(playerid, 25, 100);
GivePlayerWeapon(pvpinfo[pID][invID], 25, 100);
GivePlayerWeapon(playerid, 30, 100);
GivePlayerWeapon(pvpinfo[pID][invID], 30, 100);
ShowPlayerZoneDialog(playerid);
}
}
}
the function:
pawn Код:
public ShowPlayerGunDialog(playerid)
{
new dstr[200];
strcat(dstr,"{FFFFFF}»   {FF6600}Deagle/Shotgun - 50 kulkш.\n");
strcat(dstr,"{FFFFFF}»   {FF6600}Deagle/M4 - 100 kulkш.\n");
strcat(dstr,"{FFFFFF}»   {FF6600}Shotgun/AK-47 - 100 kulkш.\n");
ShowPlayerDialog(playerid, GunDialog, DIALOG_STYLE_LIST, "{FF0000}PASIRINKITE GINKLUS", dstr, "Pasirinkti", "Atрaukti");
return 1;
}
I thought maybe my GunDialod ID was interfering with other scripts, but i checked and it seems fine. Anyone know what could be the problem?


Re: ZCMD wont recognize command - Threshold - 23.12.2014

Show me your 'ShowPlayerZoneDialog()' function.


Re: ZCMD wont recognize command - Type-R - 24.12.2014

Here it is:

pawn Код:
public ShowPlayerZoneDialog(playerid)
{
new str[350];
strcat(str,"{FFFFFF}»   {FF6600}Arena 1\n");
strcat(str,"{FFFFFF}»   {FF6600}Arena 2\n");
strcat(str,"{FFFFFF}»   {FF6600}Arena 3\n");
ShowPlayerDialog(playerid, ZoneDialog, DIALOG_STYLE_LIST, "{FF0000}PASIRINKITE KOVOJIMO ZONА", str, "Pasirinkti", "Atрaukti");
return 1;
}
Oh and i figured out, that nothing happens after the first dialog, only when i put this other filterscript in, when i take it out everything works fine.


Re: ZCMD wont recognize command - Threshold - 24.12.2014

Do you have OnDialogResponse in the other filterscript?


Re: ZCMD wont recognize command - Type-R - 24.12.2014

Yes, but the IDs, are different.


Re: ZCMD wont recognize command - Type-R - 25.12.2014

bump


Re: ZCMD wont recognize command - Ryz - 26.12.2014

show what u have added 'OnDialogResponse'