admin Дата: Суббота, 18.12.2010, 01:53:23 | Сообщение # 1
Группа: Администраторы
Сообщений: 3869
/* Simple Stats Saver */ Code
#include <a_samp> #include <mxINI> enum pInfo { Kills, Deaths, Money } new pStats[MAX_PLAYERS][pInfo];
Code
public OnPlayerConnect(playerid) { new pConfig, pName[MAX_PLAYER_NAME], str[64]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str), "%s.ini",pName); pConfig = ini_openFile (str); if(pConfig == INI_OK) { ini_getInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_getInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_getInteger(pConfig,"Money", pStats[playerid][Money]); ini_closeFile(pConfig); SendClientMessage(playerid, 0xFFFFFF, "[S]: File found."); } else { pConfig = ini_createFile(str); SendClientMessage(playerid, 0xFFFFFF, "[S]: File is not found."); if (pConfig == INI_OK) { ini_setInteger(pConfig,"Kills", 0); ini_setInteger(pConfig,"Deaths", 0); ini_setInteger(pConfig,"Money", 0); ini_getInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_getInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_getInteger(pConfig,"Money", pStats[playerid][Money]); ini_closeFile(pConfig); SendClientMessage(playerid, 0xFFFFFF, "[S]: File Created."); } else SendClientMessage(playerid, 0xFFFFFF, "[S]: Can't create file."); } return 1; }
Code
public OnPlayerDisconnect(playerid, reason) { new pConfig, pName[MAX_PLAYER_NAME], str[64]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str), "%s.ini",pName); pConfig = ini_openFile (str); if(pConfig == INI_OK) { ini_setInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_setInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_setInteger(pConfig,"Money", GetPlayerMoney(playerid)); ini_closeFile(pConfig); } else print("Error bleat'"); return 1; }
Code
public OnPlayerDeath(playerid, killerid, reason) { pStats[killerid][Kills]++; pStats[playerid][Deaths]++; return 1; }
Code
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/stats", cmdtext, true, 7) == 0) { new str[256]; format(str, sizeof(str), "[S]: K: %d, D: %d, M: %d", pStats[playerid][Kills], pStats[playerid][Deaths], GetPlayerMoney(playerid)); SendClientMessage(playerid, 0xFFFFFF, str); return 1; } return 0; }
Источник:sa-mp.com
zm-jail.ru Разработка сайта samp-pawno.ru
Сообщение /* Simple Stats Saver */ Code
#include <a_samp> #include <mxINI> enum pInfo { Kills, Deaths, Money } new pStats[MAX_PLAYERS][pInfo];
Code
public OnPlayerConnect(playerid) { new pConfig, pName[MAX_PLAYER_NAME], str[64]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str), "%s.ini",pName); pConfig = ini_openFile (str); if(pConfig == INI_OK) { ini_getInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_getInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_getInteger(pConfig,"Money", pStats[playerid][Money]); ini_closeFile(pConfig); SendClientMessage(playerid, 0xFFFFFF, "[S]: File found."); } else { pConfig = ini_createFile(str); SendClientMessage(playerid, 0xFFFFFF, "[S]: File is not found."); if (pConfig == INI_OK) { ini_setInteger(pConfig,"Kills", 0); ini_setInteger(pConfig,"Deaths", 0); ini_setInteger(pConfig,"Money", 0); ini_getInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_getInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_getInteger(pConfig,"Money", pStats[playerid][Money]); ini_closeFile(pConfig); SendClientMessage(playerid, 0xFFFFFF, "[S]: File Created."); } else SendClientMessage(playerid, 0xFFFFFF, "[S]: Can't create file."); } return 1; }
Code
public OnPlayerDisconnect(playerid, reason) { new pConfig, pName[MAX_PLAYER_NAME], str[64]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str), "%s.ini",pName); pConfig = ini_openFile (str); if(pConfig == INI_OK) { ini_setInteger(pConfig,"Kills", pStats[playerid][Kills]); ini_setInteger(pConfig,"Deaths", pStats[playerid][Deaths]); ini_setInteger(pConfig,"Money", GetPlayerMoney(playerid)); ini_closeFile(pConfig); } else print("Error bleat'"); return 1; }
Code
public OnPlayerDeath(playerid, killerid, reason) { pStats[killerid][Kills]++; pStats[playerid][Deaths]++; return 1; }
Code
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/stats", cmdtext, true, 7) == 0) { new str[256]; format(str, sizeof(str), "[S]: K: %d, D: %d, M: %d", pStats[playerid][Kills], pStats[playerid][Deaths], GetPlayerMoney(playerid)); SendClientMessage(playerid, 0xFFFFFF, str); return 1; } return 0; }
Источник:sa-mp.com
Автор - admin Дата добавления - 18.12.2010 в 01:53:23
nadim Дата: Воскресенье, 29.09.2013, 11:28:33 | Сообщение # 4
Группа: Пользователи
Сообщений: 28
(983) : error 029: invalid expression, assumed zero (983) : error 001: expected token: "]", but found ";" (997) : error 029: invalid expression, assumed zero (997) : error 001: expected token: "]", but found ";" (1001) : error 029: invalid expression, assumed zero (1001) : error 001: expected token: "]", but found ";" ВСЕ ЭТИ ОШИБКИ ОТНОСЯТСЯ К СТРОЧКАМ ГДЕ ЕСТЬ "MONEY"
Сообщение (983) : error 029: invalid expression, assumed zero (983) : error 001: expected token: "]", but found ";" (997) : error 029: invalid expression, assumed zero (997) : error 001: expected token: "]", but found ";" (1001) : error 029: invalid expression, assumed zero (1001) : error 001: expected token: "]", but found ";" ВСЕ ЭТИ ОШИБКИ ОТНОСЯТСЯ К СТРОЧКАМ ГДЕ ЕСТЬ "MONEY" Автор - nadim Дата добавления - 29.09.2013 в 11:28:33