16.04.2015, 10:23
Well,i have made few commands,when i type the command alone without anything else it tells me to put id,but when i put invalid id it says invalid id,but when i put an id that exists is sends me the error message ,i am using ZCMD
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(success) printf("%s performed the command ( %s )", PlayerName(playerid), cmdtext);
if(!success)
{
format(string, sizeof(string), " Error:The command performed does not exist. ( %s )", cmdtext);
return SendClientMessage(playerid,-1, string);
}
return 1;
}
CMD:resetplayer(playerid, params[])
{
new player;
if(!sscanf(params, "d", player))
{
if(pInfo[player][playercreated] != 1) return SendClientMessage(playerid, -1, "Invalid player id");
else
{
pInfo[player][playercreated] = 0; //it only changes these two things
pInfo[player][playeruserid] = 0; //it only changes these two things
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[i][offerfrom] == player)
{
pInfo[i][offerfrom] = 0;
}
}
pInfo[player][playerphone] = 0;
pInfo[player][playernumber] = 0;
pInfo[player][playerkills] = 0;
pInfo[player][playerdeaths] = 0;
pInfo[player][playeritems] = 0;
format(string, sizeof(string), "You have deleted player id %d.", player);
SendClientMessage(playerid, COLOR_GREY, string);
new query[128];
mysql_format(dbHandle, query, sizeof(query), "DELETE * FROM `accounts` WHERE `Username`=%d", GetName(player));
printf("%d deleted", player);
mysql_tquery(dbHandle, query, "", "");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "/resetplayer [playerid]");
}
return 1;
}