public OnPlayerCommandText(playerid, cmdtext[])
{
CMD:testcmd(playerid, params[])
{
SendClientMessage(playerid, 0x375FFFFF, "test test test win win win");
return 1;
};
return 0;
}
error 029: invalid expression, assumed zero error 017: undefined symbol "cmd_testcmd" error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
Do not put the ZCMD commands under public OnPlayerCommandText(playerid, cmdtext[])
|
COMMAND:testcmd(playerid, params[])
{
SendClientMessage(playerid, 0x375FFFFF, "test test test win win win");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/givecash", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
return 1;
}
moneys = strval(tmp);
//printf("givecash_command: %d %d",giveplayerid,moneys);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
// PROCESS OTHER COMMANDS
return 0;
}
COMMAND:test(playerid, params[])
{
SendClientMessage(playerid COLOR_RED, " WEWEWE");
return true; // you can put true or 1
}
Dont add `;` at the end
pawn Код:
|
Compiler still crash, And same errors under onplayercmdtext (ik shouldnt be under there)
Should i try this in a filterscript..? |
Yes try it in a FS, the crash maybe will be beacuse you have the commands in strcmp + strok, and ZCMD inlcude with some commands there.
|
COMMAND:mycommand(playerid, params[])
{
//do your stuff here
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
COMMAND:(or CMD:)kick(playerid, params[])
{
// Your code
}