25.07.2015, 14:43
(
Последний раз редактировалось Luke_James; 25.07.2015 в 15:13.
)
I've done this MDC thing, but I'm having trouble calling it in the /mdc command. It should, if the player name IS valid, call "OnMDCLookup" but when I compile the script, I get these errors...
This is the line throwing the error up...
Quote:
(39712) : warning 202: number of arguments does not match definition (39712) : warning 202: number of arguments does not match definition |
Код:
IsValidPlayerName(name, "OnMDCLookup", playerid);
pawn Код:
forward OnMDCLookup(playerid, name[]);
public OnMDCLookup(playerid, name[])
{
new msg[128];
new rows, fields;
cache_get_data(rows, fields);
if(rows < 1)
{
SendClientMessage(playerid, COLOR_GREY, "No records found.");
return 1;
}
cache_get_row(0, 0, msg);
MDCLookup(playerid, strval(msg));
return 1;
}
MDCLookup(playerid, id)
{
new msg[256];
format(msg, sizeof(msg), "SELECT `c1`.`character`,`c1`.`phone`,`c1`.`id` FROM `characters` AS `c1` WHERE `c1`.`id` = %d", id);
mysql_function_query(g_iHandle, msg, true, "OnMDCRetrieve", "d", playerid);
}
forward OnMDCRetrieve(playerid);
public OnMDCRetrieve(playerid)
{
new string[128], id_string[128];
new rows, fields;
cache_get_data(rows, fields);
if(rows < 1) return 0;
SendClientMessage(playerid, COLOR_GREY,"|__________LSPD Mobile Data Computer__________|");
cache_get_row(0, 0, id_string);
format(string, sizeof(string), "NAME: %s", id_string);
SendClientMessage(playerid, COLOR_WHITE, string);
cache_get_row(0, 1, id_string);
format(string, sizeof(string), "CONTACT NUMBER: %s", id_string);
SendClientMessage(playerid, COLOR_WHITE, string);
cache_get_row(0, 2, id_string);
return 1;
}
pawn Код:
CMD:mdc(playerid, params[])
{
if (GetFactionType(playerid) != FACTION_POLICE)
return SendErrorMessage(playerid, "You must be a police officer.");
if (!IsACruiser(GetPlayerVehicleID(playerid)))
return SendErrorMessage(playerid, "You must be inside a police cruiser.");
new name[MAX_PLAYER_NAME];
if(!sscanf(params, "s[" #MAX_PLAYER_NAME "]", name)) {
IsValidPlayerName(name, "OnMDCLookup", playerid);
}
else {
return SendSyntaxMessage(playerid, "/mdc [player name]");
}
return 1;
}