|
(39712) : warning 202: number of arguments does not match definition (39712) : warning 202: number of arguments does not match definition |
IsValidPlayerName(name, "OnMDCLookup", playerid);
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;
}
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;
}
IsValidPlayerName(const str[])
{
if (!str[0] || str[0] == '\1')
return 0;
for (new i = 0, l = strlen(str); i != l; i ++)
{
if ((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
continue;
if (str[i] == '_' || str[i] == '$' || str[i] == '@' || str[i] == '[' || str[i] == ']')
continue;
else
return 0;
}
return 1;
}
if(IsValidPlayerName(name))
{
OnMDCLookup(playerid, name);
}
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)) {
if(IsValidPlayerName(name)) {
OnMDCLookup(playerid, name);
}
}
else {
return SendSyntaxMessage(playerid, "/mdc [player name]");
}
return 1;
}
MDCLookup(playerid, name[])
{
new msg[256];
format(msg, sizeof(msg), "SELECT `c1`.`character`,`c1`.`phone`,`c1`.`id` FROM `characters` AS `c1` WHERE `c1`.`name` = %s", name); //try to search a record by "name" and not "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)
{
SendClientMessage(playerid, COLOR_GREY, "No records found.");
return 1;
}
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;
}
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)) {
if(IsValidPlayerName(name))
{
MDCLookup(playerid, name);
}
}
else {
return SendSyntaxMessage(playerid, "/mdc [player name]");
}
return 1;
}
|
try this
pawn Код:
|
|
Do you have a "name" variable in your table "characters"? Then you could try something like that:
Код:
MDCLookup(playerid, name[])
{
new msg[256];
format(msg, sizeof(msg), "SELECT `c1`.`character`,`c1`.`phone`,`c1`.`id` FROM `characters` AS `c1` WHERE `c1`.`name` = %s", name); //try to search a record by "name" and not "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)
{
SendClientMessage(playerid, COLOR_GREY, "No records found.");
return 1;
}
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;
}
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)) {
if(IsValidPlayerName(name))
{
MDCLookup(playerid, name);
}
}
else {
return SendSyntaxMessage(playerid, "/mdc [player name]");
}
return 1;
}
|