30.09.2011, 19:30
well i used a tut for a register / Account System and it worked fine but when i tryed to add a admin system it started fine but because i use ZCMD and Y_INI and i want to change the INI file for the player that works mostly but when i get to the AdminLevel i want to set it the to params the player typed but i get this error:
this is being a pain and once i can sort this i will be fine here is my full script code and ill highlight the areas of the error and the script part itself:
Piece of code causing errors:
entire command its in:
thats about it can someone please help me on this one thanks
Code:
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(201) : error 035: argument type mismatch (argument 3) Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Code:
#define FILTERSCRIPT #include <a_samp> #include <YSI\y_ini> #include <sscanf2> #include <dudb> #include <zcmd> #define PATH "/Users/%s.ini" #define PLAYER_MUST_REGISTER #define REGISTERED_MONEY 5000 #define AUTOLOGIN #define white 0xFFFFFFA #define RED 0xE60000AA #define ABLUE 0x2641FEAA #define red 0xFF0000AA #define lime 0x00FF00FF #define yellow 0xFFFF00FF #define DIALOG_REGISTER 999 #define DIALOG_LOGIN 998 #define FormatMSG(%0,%1,%2,%3)\ do{\ format( _S_T_R_, sizeof ( _S_T_R_ ), ( %2 ), %3);\ SendClientMessage( ( %0 ),( %1 ), _S_T_R_);\ }\ while ( False ) #pragma unused ret_memcpy enum iDetails { Pass, Cash, Score, AdminLevel }; new pInfo[MAX_PLAYERS][iDetails]; new _S_T_R_[ 256 ]; new False=false; #if defined AUTOLOGIN new pIP[MAX_PLAYERS][16]; #endif new pLogged[MAX_PLAYERS]; stock PlayerPath(playerid) { new iStr[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(iStr,sizeof(iStr),PATH,name); return iStr; } public OnFilterScriptInit() { print("\n--------------------------------------"); print("Login & Register system by Seven_of_Nine"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } public OnGameModeExit() { return 1; } forward UserDataLoad_data(playerid,name[],value[]); public UserDataLoad_data(playerid,name[],value[]) { INI_Int("Pass",pInfo[playerid][Pass]); #if defined AUTOLOGIN INI_String("IP",pIP[playerid],16); #endif INI_Int("Cash",pInfo[playerid][Cash]); INI_Int("Score",pInfo[playerid][Score]); INI_Int("AdminLevel", pInfo[playerid][AdminLevel]); return 1; } public OnPlayerConnect(playerid) { pLogged[playerid] = 0; #if defined AUTOLOGIN new tmpIP[16]; GetPlayerIp(playerid,tmpIP,sizeof(tmpIP)); #endif if(fexist(PlayerPath(playerid))) { INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid); #if defined AUTOLOGIN if(strcmp(tmpIP,pIP[playerid],true) == 0) { pLogged[playerid] = 1; SetPlayerScore(playerid,pInfo[playerid][Score]); GivePlayerMoney(playerid,pInfo[playerid][Cash]); SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]"); return 1; } #endif ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave"); } else { ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave"); } return 1; } public OnPlayerDisconnect(playerid, reason) { if(pLogged[playerid] == 1) { new INI:iFile = INI_Open(PlayerPath(playerid)); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(iFile,"Score",GetPlayerScore(playerid)); INI_Close(iFile); } pLogged[playerid] = 0; return 1; } public OnPlayerRequestSpawn(playerid) { if(pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!"); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_REGISTER) { GetPlayerIp(playerid,pIP[playerid],16); if(!response) Kick(playerid); if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave"); new INI:iFile = INI_Open(PlayerPath(playerid)); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"Pass",udb_hash(inputtext)); #if defined AUTOLOGIN INI_WriteString(iFile,"IP",pIP[playerid]); #endif INI_WriteInt(iFile,"Cash",REGISTERED_MONEY); INI_WriteInt(iFile,"Score",0); INI_WriteInt(iFile,"AdminLevel",0); INI_Close(iFile); pLogged[playerid] = 1; new iStr[128]; format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext); SendClientMessage(playerid,yellow,iStr); return 1; } if(dialogid == DIALOG_LOGIN) { if(!response) Kick(playerid); new iStr[128],gTries; if(gTries == 0) gTries = 1; if(gTries == 3) { new pName[30]; GetPlayerName(playerid,pName,sizeof(pName)); format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName); SendClientMessageToAll(red,iStr); return Kick(playerid); } if(!strlen(inputtext)) { format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries); return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave"); } if(udb_hash(inputtext) == pInfo[playerid][Pass]) { pLogged[playerid] = 1; SendClientMessage(playerid,lime,"You've successfully logged in."); SetPlayerScore(playerid,pInfo[playerid][Score]); GivePlayerMoney(playerid,pInfo[playerid][Cash]); } else { format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave"); gTries++; return 1; } return 1; } return 1; } CMD:SetLevel(playerid, params[]) { if(pInfo[playerid][AdminLevel] >= 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED,"ERROR: You need to be administrator to use this command!"); { new Player, aLevel; if(sscanf(params, "ui", Player, aLevel)) return SendClientMessage(playerid, RED,"USAGE {FFFF00}/SetLevel [PlayerID] [Level]"); if(aLevel > 5 ) return SendClientMessage( playerid, 0xE60000AA, "ERROR: Invalid level! Max admin level you can set is 5!" ); if(IsPlayerConnected(Player)) { new INI:iFile = INI_Open(PlayerPath(playerid)); FormatMSG(Player, ABLUE, "Welcome To The Pilots Heaven Team %s has set your Level to %d", PlayerName2(playerid), aLevel); FormatMSG(playerid, ABLUE, "You Have Set %s's Admin Level to %d", PlayerName2(Player), aLevel); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"AdminLevel",params); INI_Close(iFile); } else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!"); return 1; } } //================================================================== [ STOCKS ] ===========================================================// stock PlayerName2( i ) { new n[ 24 ]; GetPlayerName( i, n, 24 ); return n; }
Code:
INI_WriteInt(iFile,"AdminLevel",params);
Code:
CMD:SetLevel(playerid, params[]) { if(pInfo[playerid][AdminLevel] >= 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED,"ERROR: You need to be administrator to use this command!"); { new Player, aLevel; if(sscanf(params, "ui", Player, aLevel)) return SendClientMessage(playerid, RED,"USAGE {FFFF00}/SetLevel [PlayerID] [Level]"); if(aLevel > 5 ) return SendClientMessage( playerid, 0xE60000AA, "ERROR: Invalid level! Max admin level you can set is 5!" ); if(IsPlayerConnected(Player)) { new INI:iFile = INI_Open(PlayerPath(playerid)); FormatMSG(Player, ABLUE, "Welcome To The Pilots Heaven Team %s has set your Level to %d", PlayerName2(playerid), aLevel); FormatMSG(playerid, ABLUE, "You Have Set %s's Admin Level to %d", PlayerName2(Player), aLevel); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"AdminLevel",params); INI_Close(iFile); } else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!"); return 1; } }