PDA

View Full Version : Argument type mismatch (argument 3), Please HELP!!!


bgedition
29/04/2015, 04:19 PM
Hello Humans :D
You know what to do! pleas help me

the error:
BulgEdition.pwn(141) : error 035: argument type mismatch (argument 3)

That is part of account system:

LoginAttempts[playerid]--;
format(string, sizeof(string), "Welcome back %s to Bulgarian Edition!\nType your password below to login into your account!\nYou have %d attempts left!", GetPName(playerid), LoginAttempts[playerid]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login into your account.", string, "Login", "Cancel");
if(LoginAttempts[playerid] == 1) {
format(string, sizeof(string), "Welcome back %s to Bulgarian Edition!\nType your password below to login into your account!\nThat is your FINAL attempt!", GetPName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login into your account.", string, "Login", "Cancel");
} else if(LoginAttempts[playerid] == 0) {
new kickerid = -1;
SendClientMessage(playerid, -1, "You has been kicked by the server. Reason: Incorrect Password.");
format(string, sizeof(string), "%s has been kicked by the server. Reason: %s", GetPName(playerid), ServerReasons[0]);
for(new i; i < MAX_PLAYERS; i++) {
if(i == playerid) continue;
SendClientMessage(i, -1, string);
}
Line 141: PublicKick(playerid, kickerid, ServerReasons[0]);
}
stock PublicKick(playerid, kickerid, reason) {
LogSave(0, playerid, kickerid, reason);
Kick(playerid);
return 1;
}

J0sh...
29/04/2015, 04:36 PM
Where is the Line?

Darkwood17
29/04/2015, 04:36 PM
On which line you got that error?

bgedition
29/04/2015, 04:37 PM
Dudes its wroten

J0sh...
29/04/2015, 04:38 PM
What is the server reasons array?

bgedition
29/04/2015, 04:41 PM
There is

new ServerReasons[][] = {
{"Invalid Password."}, {"s-0beit"}
};

bgedition
29/04/2015, 04:54 PM
That is not bumping I just wantst to say if someone wants to see the full code there is no problem. Just say it.

alexus
29/04/2015, 04:57 PM
First, reason has to be a string so declare

stock PublicKick(playerid, kickerid, reason[])

and the inside brackets are not necessary

{"Invalid Password.","s-0beit"}

bgedition
29/04/2015, 05:03 PM
Ok that works but now we have the same error but with argument 4 in line 159 which is:

stock PublicKick(playerid, kickerid, reason[]) {
line 159: LogSave(0, playerid, kickerid, reason);
Kick(playerid);
return 1;
}

because of this brackets

alexus
29/04/2015, 05:17 PM
Can you show the beginning of LogSave ?

bgedition
29/04/2015, 05:18 PM
That is my full script and as you will see its not completed

//================================>>> Gamemode Script Bulgarian Edition by Michael Goodman v0.0.1
//===> Includes
#include <a_samp>
#include <a_mysql>
#include <sscanf>
#include <zcmd>
#include <streamer>
#include <Others>
//===> Defines
//---> Mysql
#define mysql_host "localhost"
#define mysql_user "root"
#define mysql_password "bg3diti0n"
#define mysql_database "sampgameserver"
//---> Dialog IDs
#define DIALOG_LOGIN 69
#define DIALOG_REGISTER 70
//---> Other Defines
//===> Natives
//===> Enums
enum pInfo {
pID, pPassword[150], pIP[16], pCity, pCountry, pLanguage, pPhoneNumber, pRegistered, pLastLogin, pStatus, pPlayedTime, pLevel, pVIPLevel, pAdminLevel,
pXP, pTotalXP, pKills, pDeaths, pMoney, pCredits, pHome, pGang, pBusiness, pOwnGang, pJob, pVehicles, pSkin, pWarnings, pRank, pCups
}
//===> Forwards
forward OnPlayerLogin(playerid);
forward OnPlayerLogout(playerid, reason);
forward OnPlayerRegister(playerid);
forward OnPlayerSave(playerid);
forward OnPlayerCheck(playerid);
//===> News
new mysql_handle;
new PlayerInfo[MAX_PLAYERS][pInfo], bool:LoggedIn[MAX_PLAYERS], LoginAttempts[MAX_PLAYERS];
new ServerReasons[][] = {
"Invalid Password.", "******"
};
main() {
print("================================================== ====");
print(" ");
print(" Bulgarian Edition Gamemode Script by Michael Goodman ");
print(" ");
print("================================================== ====");
}

public OnGameModeInit() {
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
mysql_handle = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
if(mysql_errno(mysql_handle) != 0) print("[ERROR]: Could not connect to database!");
return 1;
}

public OnGameModeExit() {
return 1;
}

public OnPlayerConnect(playerid) {
new Query[200];
LoggedIn[playerid] = false, LoginAttempts[playerid] = 5;
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
mysql_format(mysql_handle, Query, sizeof(Query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Username` = '%s' LIMIT 1", GetPName(playerid));
mysql_tquery(mysql_handle, Query, "OnPlayerCheck", "d", playerid);
return 1;
}

public OnPlayerDisconnect(playerid, reason) {
LoggedIn[playerid] = false, LoginAttempts[playerid] = 5;
return 1;
}

public OnPlayerLogin(playerid) {
return 1;
}

public OnPlayerLogout(playerid, reason) {
return 1;
}

public OnPlayerRegister(playerid) {
return 1;
}

public OnPlayerSave(playerid) {
return 1;
}

public OnPlayerCheck(playerid) {
new rows, fields, string[350];
cache_get_data(rows, fields, mysql_handle);
if(rows) {
cache_get_field_content(0, "Password", PlayerInfo[playerid][pPassword], mysql_handle, 150);
PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
format(string, sizeof(string), "Welcome back %s to Bulgarian Edition!\nType your password below to login into your account!\nYou have %d attempts left!", GetPName(playerid), LoginAttempts[playerid]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login into your account.", string, "Login", "Cancel");
} else {
format(string, sizeof(string), "Welcome %s to Bulgarian Edition!\n Type your password below to register new account!\n", GetPName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register new account.", string, "Register", "Cancel");
}
return 1;
}

public OnPlayerSpawn(playerid) {
return 1;
}

public OnPlayerDeath(playerid, killerid, reason) {
return 1;
}

public OnPlayerText(playerid, text[]) {
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[]) {
return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == DIALOG_LOGIN) {
if(response) {
new HashPassword[150], query[875], string[326];
WP_Hash(HashPassword, 150, inputtext);
if(!strcmp(HashPassword, PlayerInfo[playerid][pPassword])) {
mysql_format(mysql_handle, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s' LIMIT 1", GetPName(playerid));
mysql_tquery(mysql_handle, query, "OnPlayerLogin", "d", playerid);
} else {
LoginAttempts[playerid]--;
format(string, sizeof(string), "Welcome back %s to Bulgarian Edition!\nType your password below to login into your account!\nYou have %d attempts left!", GetPName(playerid), LoginAttempts[playerid]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login into your account.", string, "Login", "Cancel");
if(LoginAttempts[playerid] == 1) {
format(string, sizeof(string), "Welcome back %s to Bulgarian Edition!\nType your password below to login into your account!\nThat is your FINAL attempt!", GetPName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login into your account.", string, "Login", "Cancel");
} else if(LoginAttempts[playerid] == 0) {
new kickerid = -1;
SendClientMessage(playerid, -1, "You has been kicked by the server. Reason: Incorrect Password.");
format(string, sizeof(string), "%s has been kicked by the server. Reason: %s", GetPName(playerid), ServerReasons[0]);
for(new i; i < MAX_PLAYERS; i++) {
if(i == playerid) continue;
SendClientMessage(i, -1, string);
}
PublicKick(playerid, kickerid, ServerReasons[0]);
}
}
} else {

}
}
return 1;
}

//-----Stocks
stock GetPName(playerid) {
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}

stock PublicKick(playerid, kickerid, reason[]) {
LogSave(0, playerid, kickerid, reason);
Kick(playerid);
return 1;
}

stock LogSave(logid, playerid, id, reason) {
new File:Log, LogPath[256], string[256], year, month, day, hour, minute, second;
getdate(year, month, day), gettime(hour, minute, second);
switch(logid) {
case 0: {
format(LogPath, sizeof(LogPath), "Logs/Kick.logs");
Log = fopen(LogPath, io_append);
format(string, sizeof(string), "[%02d/%02d/%02d | %02d:%02d:%02d] %s has been kicked by %s. Reason: %s\n", day, month, year, hour, minute, second, GetPName(playerid), GetPName(id), reason);
fwrite(Log, string);
fclose(Log);
}
}
return 1;
}

bgedition
29/04/2015, 05:49 PM
Problem SLOVED!