cmd problem [+REP]
#1

hi guys i need a small help the cmd work but it show me SERVER: Unknown Command

pawn Код:
CMD:sellhouse(playerid, params[])
{
    if(pInfo[playerid][HouseKey] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You don't have a house to sell.");
    {
        new string[256], Query[1000];
        pInfo[playerid][Money] += hInfo[pInfo[playerid][HouseKey]][HousePrice] / 2 + 5000;
        format(hInfo[pInfo[playerid][HouseKey]][HouseOwner], 24, "Nobody");
        format(string, sizeof(string), "You have sold '%s' for $%d.", hInfo[pInfo[playerid][HouseKey]][HouseName], hInfo[pInfo[playerid][HouseKey]][HousePrice] / 2 + 5000);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        mysql_format(mysql, Query, sizeof(Query), "UPDATE `Houses` SET `HouseOwner` = 'Nobody' WHERE `hID` = %i", pInfo[playerid][HouseKey]);
        mysql_query(mysql, Query);
        mysql_free_result();
        pInfo[playerid][HouseKey] = 0;
        SavePlayer(playerid);
    }
    return 1;
}
sorry for my bad english
thnx
Reply
#2

anyone?
Reply
#3

Try using this callback:

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return GameTextForPlayer(playerid, "~g~Unknown command", 3000, 4);
    return 1;
}
Reply
#4

Quote:
Originally Posted by Boot
Посмотреть сообщение
Try using this callback:

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return GameTextForPlayer(playerid, "~g~Unknown command", 3000, 4);
    return 1;
}
same problem Unknow Command even if it works plz help
Reply
#5

Quote:
Originally Posted by simo0000
Посмотреть сообщение
same problem Unknow Command even if it works plz help
Ah sorry, just put return 0; on OnPlayerText callback.
Reply
#6

Quote:
Originally Posted by Boot
Посмотреть сообщение
Ah sorry, just put return 0; on OnPlayerText callback.
it's ZCMD command mate how to fix it?
Reply
#7

Quote:
Originally Posted by simo0000
Посмотреть сообщение
it's ZCMD command mate how to fix it?
Did you do what I suggested to?
Reply
#8

Quote:
Originally Posted by Boot
Посмотреть сообщение
Try using this callback:

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return GameTextForPlayer(playerid, "~g~Unknown command", 3000, 4);
    return 1;
}
Quote:
Originally Posted by Boot
Посмотреть сообщение
Ah sorry, just put return 0; on OnPlayerText callback.
None of those has any remote relation to his problem, returning 0 in OnPlayerText cancels the player's text message if he writes something in the chat that doesn't contain /[text].
And the only way OnPlayerCommandPerformed would help if he set it up like this:
pawn Код:
if(success) return 0; // Or return a msg, whatever
Reply
#9

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
None of those has any remote relation to his problem, returning 0 in OnPlayerText cancels the player's text message if he writes something in the chat that doesn't contain /[text].
And the only way OnPlayerCommandPerformed would help if he set it up like this:
pawn Код:
if(success) return 0; // Or return a msg, whatever
lol same problem plz help
Reply
#10

Quote:
Originally Posted by simo0000
pawn Код:
new string[256], Query[1000];
pawn Код:
mysql_format(mysql, Query, sizeof(Query), "UPDATE `Houses` SET `HouseOwner` = 'Nobody' WHERE `hID` = %i", pInfo[playerid][HouseKey]);
You are using a query variable with the size of a 1000 for what exactly? The length of your actual query is not even a 100 characters! Same goes with the string size, why are you using a 256 long variable for a string that cannot even reach 50 characters.

Please read this:
https://sampforum.blast.hk/showthread.php?tid=55261

For the actual problem:
Your h/p - Info enum is probably out of bounds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)