09.05.2014, 05:57
hello
please help me.
When the player is destroyed by other players. = +1Kills To Stats
When the player is destroyed. = +1Deaths To Stats
How do I do it?
------------------------------------------------------------------------------
Command :
please help me.
When the player is destroyed by other players. = +1Kills To Stats
When the player is destroyed. = +1Deaths To Stats
How do I do it?
------------------------------------------------------------------------------
Код:
#include <a_samp> #include <YSI\y_ini> #include <zcmd> #include <sscanf2> #include <foreach> native WP_Hash(buffer[], len, const str[]); #define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define DIALOG_SUCCESS_1 3 #define DIALOG_SUCCESS_2 4 #define PATH "/Admin/Users/%s.ini" enum pInfo { pPass[129], pCash, pAdmin, pKills, pDeaths } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_String("Password",PlayerInfo[playerid][pPass], 129); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); return 1; } stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Please Type Password.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register","Please Type Password For Register.","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_PASSWORD, "Register","Password Is Wrong. Please Type Password.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"PlayerData"); new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); INI_WriteString(File, "Password", HashPass); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",-1); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Creating Account","Check Site : www.sitename.com","ok",""); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0) { INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Register End","You have successfully entered a severe account. Check Site: www.sitename.com","ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","wrong password.","Login","Quit"); } return 1; } } } return 1; } public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"PlayerData"); 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_Close(File); return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; }
Код:
CMD:stats(playerid, params[]) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); new coordsstring[1024]; format(coordsstring, sizeof(coordsstring), "Player: %s\nAdmin Level: %d\nScore: %d\nMoney: $%d\nKills: %d\nDeaths: %d", name, PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pScore], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]); ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Amar",coordsstring,"ok",""); return 1; }