cmd problem [+REP] - 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: cmd problem [+REP] (
/showthread.php?tid=564441)
cmd problem [+REP] -
simo0000 - 21.02.2015
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
Re : cmd problem [+REP] -
simo0000 - 21.02.2015
anyone?
Re: cmd problem [+REP] -
Boot - 21.02.2015
Try using this callback:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) return GameTextForPlayer(playerid, "~g~Unknown command", 3000, 4);
return 1;
}
Re : Re: cmd problem [+REP] -
simo0000 - 21.02.2015
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
Re: Re : Re: cmd problem [+REP] -
Boot - 21.02.2015
Quote:
Originally Posted by simo0000
same problem Unknow Command even if it works plz help
|
Ah sorry, just put return 0; on OnPlayerText callback.
Re : Re: Re : Re: cmd problem [+REP] -
simo0000 - 21.02.2015
Quote:
Originally Posted by Boot
Ah sorry, just put return 0; on OnPlayerText callback.
|
it's ZCMD command mate
how to fix it?
Re: Re : Re: Re : Re: cmd problem [+REP] -
Boot - 21.02.2015
Quote:
Originally Posted by simo0000
it's ZCMD command mate how to fix it?
|
Did you do what I suggested to?
Re: Re : Re: cmd problem [+REP] -
CalvinC - 21.02.2015
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
Re : Re: Re : Re: cmd problem [+REP] -
simo0000 - 21.02.2015
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
Re: cmd problem [+REP] -
AndySedeyn - 21.02.2015
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.