Why the server says "Unknown CMD" ?
#1

PHP код:
else if(!strcmp(params"sex"true))
    {
        new 
playerb=SexBy[playerb],price;
        if(
playerb == -1) return SendClientMessage(playeridCOLOR_GREY"Nobody has offered you sex.");
        
format(stringsizeof(string), " You had sex with %s for $%d."RPN(playerb), price);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof(string), " %s had sex with you for $%d."RPN(playerid), price);
        
SendClientMessage(playerbCOLOR_LIGHTBLUEstring);
        
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] < 50WhoreTime[playerid] = 150;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100WhoreTime[playerid] = 120;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150WhoreTime[playerid] = 90;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200WhoreTime[playerid] = 60;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250WhoreTime[playerid] = 30;
        
SetTimerEx("WhoreTimer"1000false"i"playerid);
        new 
newjoldj;
        
newj strval(RPJL(playerid,JOB_WHORE));
        
oldj strval(RPJL(playerid,JOB_WHORE));
         if(
oldj newj)
        {
        
format(stringsizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **"newj);
        
SendClientMessage(playeridCOLOR_YELLOWstring);
        }
    } 
This is part of /accept CMD and all other parts work but this dont work, when someone type /accept sex server says:
Unknown CMD
Reply
#2

Load crashdetect plugin and compile 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.
Reply
#3

Код:
[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:14132
[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:108
[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
Reply
#4

What's line is 14132?
Reply
#5

if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you sex.");
Reply
#6

pawn Код:
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;
    }
Reply
#7

That makes no sense. Did you add/remove lines after posting the results above?

Change to:
pawn Код:
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?
Reply
#8

Server again says :Unknown CMD
I made CMD
PHP код:
CMD:asex(playeridparams[])
{
        new 
playerb=SexBy[playerb],pricestring[128];
        if(
playerb == -1) return SendClientMessage(playeridCOLOR_GREY"Nobody has offered you sex.");
        
format(stringsizeof(string), " You had sex with %s for $%d."RPN(playerb), price);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof(string), " %s had sex with you for $%d."RPN(playerid), price);
        
SendClientMessage(playerbCOLOR_LIGHTBLUEstring);
        
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] < 50WhoreTime[playerid] = 150;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100WhoreTime[playerid] = 120;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150WhoreTime[playerid] = 90;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200WhoreTime[playerid] = 60;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250WhoreTime[playerid] = 30;
        
SetTimerEx("WhoreTimer"1000false"i"playerid);
        new 
newjoldj;
        
newj strval(RPJL(playerid,JOB_WHORE));
        
oldj strval(RPJL(playerid,JOB_WHORE));
         if(
oldj newj)
        {
        
format(stringsizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **"newj);
        
SendClientMessage(playeridCOLOR_YELLOWstring);
        }
    return 
1;

Its the same and works dont know why dont want to work with /accept
Reply
#9

Quote:
Originally Posted by barts
Посмотреть сообщение
Server again says :Unknown CMD
I made CMD
PHP код:
CMD:asex(playeridparams[])
{
        new 
playerb=SexBy[playerb],pricestring[128];
        if(
playerb == -1) return SendClientMessage(playeridCOLOR_GREY"Nobody has offered you sex.");
        
format(stringsizeof(string), " You had sex with %s for $%d."RPN(playerb), price);
        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
        
format(stringsizeof(string), " %s had sex with you for $%d."RPN(playerid), price);
        
SendClientMessage(playerbCOLOR_LIGHTBLUEstring);
        
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] < 50WhoreTime[playerid] = 150;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 100WhoreTime[playerid] = 120;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 150WhoreTime[playerid] = 90;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] < 200WhoreTime[playerid] = 60;
        else if(
PlayerInfo[playerid][pJobSkill][JOB_WHORE] >= 250WhoreTime[playerid] = 30;
        
SetTimerEx("WhoreTimer"1000false"i"playerid);
        new 
newjoldj;
        
newj strval(RPJL(playerid,JOB_WHORE));
        
oldj strval(RPJL(playerid,JOB_WHORE));
         if(
oldj newj)
        {
        
format(stringsizeof(string), "** Your Whore level is now %d, you can now have Sex faster. **"newj);
        
SendClientMessage(playeridCOLOR_YELLOWstring);
        }
    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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)