- 0
Ajutor AdmiN
-
Similar Content
-
- 3 replies
- 130 views
-
- 0 replies
- 93 views
-
- 4 replies
- 169 views
-
- 5 replies
- 377 views
-
- 1 reply
- 248 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
Sollace
Nick: Sollace
Problema: Am creat un gamemode,i-am adaugat cateva sisteme,iar acum trebuie sa fac sistemul de admin...Am adaugat niste defin-uri,iar cand dau compile imi da Pawno Compile Library s-a oprit!Stiu ca asta da doar atunci cand sunt 20+ erori.
Erori / warnings:
Lini/script:[pawn]//=========================================Includ-uri/Defin-uri========================================//
#define MODE_NAME "hG Base"
#include <YSI\y_ini>
#include <a_samp>
#include <zcmd>
//========================================Defin-uri Importante=============================================//
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define MODE_NAME "hG Base"
#define PATH "Users/%s.ini"
//=====================================Defin-uri Culori====================================================//
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
native WP_Hash(buffer[],len,const str[]);
//====================================Enum-uri===============================================================//
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pHelper,
pTutorial,
pGun1,
pGun2,
pGun3
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new pAdmin[MAX_PLAYERS];
//====================================Forward-uri si Public-uri=================================================================//
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Helper",PlayerInfo[playerid][pHelper]);
INI_Int("Helper",PlayerInfo[playerid][pHelper]);
INI_Int("Tutorial",PlayerInfo[playerid][pTutorial]);
INI_Int("Gun1",PlayerInfo[playerid][pGun1]);
INI_Int("Gun2",PlayerInfo[playerid][pGun2]);
INI_Int("Gun3",PlayerInfo[playerid][pGun3]);
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Scrie-ti parola aici pentru a te LOGA!","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"Scrie-ti parola ta aici pentru a de InRegistra!","Register","Quit");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new hPassword[ 129 ] ;
WP_Hash( hPassword, sizeof( hPassword ), inputtext ) ;
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",hPassword);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Helper",0);
INI_WriteInt(File,"Tutorial",0);
INI_WriteInt(File,"Gun1",0);
INI_WriteInt(File,"Gun2",0);
INI_WriteInt(File,"Gun3",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Te-ai inregistrat cu SUCCES pe serverul hGaming RPG!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new hPassword[ 129 ] ;
WP_Hash( hPassword, sizeof( hPassword ), inputtext ) ;
if(!strcmp(hPassword, PlayerInfo[ playerid ][ pPass ], false ) )
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Te-ai logat cu SUCCES pe serverul hGaming RPG! ","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Ai introdus o parola gresita!\n"COL_WHITE"Scrie parola ta in casuta de mai jos pentru a te LOGA!","Login","Quit");
}
return 1;
}
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTutorial]);
INI_WriteInt(File,"Gun1",PlayerInfo[playerid][pGun1]);
INI_WriteInt(File,"Gun2",PlayerInfo[playerid][pGun2]);
INI_WriteInt(File,"Gun3",PlayerInfo[playerid][pGun3]);
INI_Close(File);
return 1;
}
public OnGameModeInit()
{
SetGameModeText( "hGaming Base" ) ;
}
//====================================Stock-uri=========================================================================================//
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//===================================Comenzi====================================================================================================//
CMD:makeadmin(playerid,params[])
{
if(IsPlayerAdmin(playerid)) return
{
if(sscanf(params,"ui",ID,admin)) return SendClientMessage(playerid,COLOR_RED,"Foloseste /makeadmin [iD] [level].");
else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED,"Playerul nu este conectat.");
else if(admin > 6) return SendClientMessage(playerid,COLOR_RED,"Levelul maxim este 6.");
else
{
new str[70],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];new admin;
PlayerInfo[playerid][pAdmin] = admin;
GetPlayerName(playerid,aname,sizeof(aname));
GetPlayerName(ID,name,sizeof(name));
format(str,sizeof str,"I-ai lui %s admin level %i.",name,admin);
SendClientMessage(playerid,COLOR_RED,str);
format(str,sizeof str,"%s ti-a dat admin level %i.",aname,admin);
SendClientMessage(ID,COLOR_RED,str);
}
}else return SendClientMessage(playerid,COLOR_RED,"Trebuie sa fi logat cu RCON.");
return 1;
}[/pawn]
Ai incercat sa rezolvi singur ?:Da.....
Link to comment
Share on other sites
1 answer to this question
Recommended Posts