PDA

View Full Version : Why the server says "Unknown CMD" ?


barts
28/01/2014, 11:18 AM
else if(!strcmp(params, "sex", true))
{
new playerb=SexBy[playerb],price;
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");
format(string, sizeof(string), " You had sex with %s for $%d.", RPN(playerb), price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s had sex with you for $%d.", RPN(playerid), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
PlayerInfo[playerb][pJobSkill][JOB_WHORE] ++;
GiveDodMoney(playerid,-sexprice);
GiveDodMoney(playerb,sexprice);
Sex[playerb] = 1;
PlayerInfo[playerid][pJobSkill][JOB_WHORE] ++;
if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 50) WhoreTime[playerid] = 150;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100) WhoreTime[playerid] = 120;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150) WhoreTime[playerid] = 90;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200) WhoreTime[playerid] = 60;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250) WhoreTime[playerid] = 30;
SetTimerEx("WhoreTimer", 1000, false, "i", playerid);
new newj, oldj;
newj = strval(RPJL(playerid,JOB_WHORE));
oldj = strval(RPJL(playerid,JOB_WHORE));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **", newj);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
This is part of /accept CMD and all other parts work but this dont work, when someone type /accept sex server says:
Unknown CMD

Konstantinos
28/01/2014, 11:23 AM
Load crashdetect (https://github.com/Zeex/samp-plugin-crashdetect/releases/tag/v4.13) plugin and compile with debug info. (https://github.com/Zeex/samp-plugin-crashdetect/wiki/Compiling-scripts-with-debug-info) Re-compile your scripts, start the server and type the command again. In case it shows the unknown command, post the server log.

barts
28/01/2014, 11:36 AM
[14:49:37] [debug] Run time error 4: "Array index out of bounds"
[14:49:37] [debug] Accessing element at index 2147483647 past array upper bound 499
[14:49:37] [debug] AMX backtrace:
[14:49:37] [debug] #0 000f8d20 in public cmd_accept (playerid=0, params[]=@0x00e266c0 "sex") at C:\Users\****\Desktop\****\gamemodes\****.pwn:1413 2
[14:49:37] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[14:49:37] [debug] #2 0000fd34 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x00e26690 "/accept sex") at C:\Users\****\Desktop\***\pawno\include\zcmd.inc:1 08
[14:49:37] [cmd] [****]: /accept sex
[14:49:38] [debug] Run time error 4: "Array index out of bounds"
[14:49:38] [debug] Accessing element at index 2147483647 past array upper bound 499
[14:49:38] [debug] AMX backtrace:
[14:49:38] [debug] #0 000f8d20 in public cmd_accept (playerid=0, params[]=@0x00e266c0 "sex") at C:\Users\****\Desktop\***\gamemodes\****.pwn:14132
[14:49:38] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[14:49:38] [debug] #2 0000fd34 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x00e26690 "/accept sex") at C:\Users\*****\Desktop\****\pawno\include\zcmd.inc :108

Konstantinos
28/01/2014, 11:53 AM
What's line is 14132?

barts
28/01/2014, 11:54 AM
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");

ProjectMan
28/01/2014, 11:55 AM
else if(!strcmp(params, "sex", true))
{
new playerb=SexBy[playerb],price;
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");
format(string, sizeof(string), " You had sex with %s for $%d.", RPN(playerb), price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s had sex with you for $%d.", RPN(playerid), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
PlayerInfo[playerb][pJobSkill][JOB_WHORE] ++;
GiveDodMoney(playerid,-sexprice);
GiveDodMoney(playerb,sexprice);
Sex[playerb] = 1;
PlayerInfo[playerid][pJobSkill][JOB_WHORE] ++;
if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 50) WhoreTime[playerid] = 150;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100) WhoreTime[playerid] = 120;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150) WhoreTime[playerid] = 90;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200) WhoreTime[playerid] = 60;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250) WhoreTime[playerid] = 30;
SetTimerEx("WhoreTimer", 1000, false, "i", playerid);
new newj, oldj;
newj = strval(RPJL(playerid,JOB_WHORE));
oldj = strval(RPJL(playerid,JOB_WHORE));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **", newj);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}

Konstantinos
28/01/2014, 11:57 AM
That makes no sense. Did you add/remove lines after posting the results above?

Change to:

new playerb=SexBy[playerb],price;
if(!(0 <= playerb < MAX_PLAYERS)) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");

and try again. Does it give run time error again?

barts
28/01/2014, 12:00 PM
Server again says :Unknown CMD
I made CMD
CMD:asex(playerid, params[])
{
new playerb=SexBy[playerb],price, string[128];
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");
format(string, sizeof(string), " You had sex with %s for $%d.", RPN(playerb), price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s had sex with you for $%d.", RPN(playerid), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
PlayerInfo[playerb][pJobSkill][JOB_WHORE] ++;
GiveDodMoney(playerid,-sexprice);
GiveDodMoney(playerb,sexprice);
Sex[playerb] = 1;
PlayerInfo[playerid][pJobSkill][JOB_WHORE] ++;
if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 50) WhoreTime[playerid] = 150;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100) WhoreTime[playerid] = 120;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150) WhoreTime[playerid] = 90;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200) WhoreTime[playerid] = 60;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250) WhoreTime[playerid] = 30;
SetTimerEx("WhoreTimer", 1000, false, "i", playerid);
new newj, oldj;
newj = strval(RPJL(playerid,JOB_WHORE));
oldj = strval(RPJL(playerid,JOB_WHORE));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **", newj);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
Its the same and works dont know why dont want to work with /accept

ProjectMan
28/01/2014, 12:10 PM
Server again says :Unknown CMD
I made CMD
CMD:asex(playerid, params[])
{
new playerb=SexBy[playerb],price, string[128];
if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");
format(string, sizeof(string), " You had sex with %s for $%d.", RPN(playerb), price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " %s had sex with you for $%d.", RPN(playerid), price);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
PlayerInfo[playerb][pJobSkill][JOB_WHORE] ++;
GiveDodMoney(playerid,-sexprice);
GiveDodMoney(playerb,sexprice);
Sex[playerb] = 1;
PlayerInfo[playerid][pJobSkill][JOB_WHORE] ++;
if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 50) WhoreTime[playerid] = 150;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100) WhoreTime[playerid] = 120;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150) WhoreTime[playerid] = 90;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200) WhoreTime[playerid] = 60;
else if(PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250) WhoreTime[playerid] = 30;
SetTimerEx("WhoreTimer", 1000, false, "i", playerid);
new newj, oldj;
newj = strval(RPJL(playerid,JOB_WHORE));
oldj = strval(RPJL(playerid,JOB_WHORE));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **", newj);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
Its the same and works dont know why dont want to work with /accept

Please post your whole "/accept" command so I can see what is wrong there.