[12:12:04] sscanf warning: Unenclosed specifier parameters are deprecated, consider using something like p<?>. [12:12:04] sscanf warning: Strings without a length are deprecated, please add a destination size. [12:12:04] sscanf warning: Strings without a length are deprecated, please add a destination size.
stock CheckBan(playerid)
{
format(post_string, sizeof(post_string), "action=checkip&apikey="#APIKEY"&ban_ip=%s", ips[playerid]);
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnCheckResponse");
return 1;
}
public OnBanResponse(index, response_code, data[])
{
if(response_code == 200)
if(strcmp(data, "Success?Ban added", true)) printf("[SAMP-BANS]: Error, API responded with: %s", data);
else SendClientMessage(index, 0xFFFFFF, "The ban was added");
else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}
public OnRemoveResponse(index, response_code, data[])
{
if(response_code == 200)
{
if(sscanf(data, "p<?>ss", error, code)) printf("[SAMP-BANS]: Error, API responded with: %s", data);
else if(strcmp(error, "Success", true) == 0) SendClientMessage(index, COLOR_RED, code);
}
else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}
public OnCheckResponse(index, response_code, data[])
{
if(response_code == 200)
{
if(sscanf(data, "p<?>ss", error, code)) printf("[SAMP-BANS]: Error, API responded with: %s", data);
else if(strcmp(error, "Success", true) == 0)
{
SendClientMessage(index, 0xFFFFFF, code);
Kick(index);
printf("[SAMP-BANS]: %s", code);
}
else if(strcmp(code, "Ban not found")) printf("[SAMP-BANS]: Error, API responded with: %s", code);
}
else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}
Read the goddamn sscanf topic.
Your problems will dissapear if you fix "p<?>ss". Protip: string length |
I'm not native english speaker, but your sentence killed me a little inside. What do you mean?
If you are using space as delimeter, then you have to change "?" to " " |
#define MAX_POST_LENGTH MAX_API_LENGTH+MAX_PLAYER_IP+MAX_REASON_LENGTH+MAX_EXTRA_LENGTH+MAX_TIME_LENGTH+MAX_PLAYER_NAME+MAX_PLAYER_NAME
new post_string[MAX_POST_LENGTH];