Код:
#include <a_samp>
#include <zcmd>
#include <streamer>
#include <sscanf>
#include <dini>
#include <foreach>
#include <Dutils> // This include is used for some important function
#include <Dudb> // This include is used for hashing password
#pragma unused ret_memcpy // This avoid the ret_memcpy warning
#define savefolder "/save/%s.ini" // This defines the file name and folder
enum
e_PlayerInfo
{
superadmin,
pSS
};
new pInfo[MAX_PLAYERS][e_PlayerInfo];
public OnPlayerDisconnect(playerid)
{
new pname[128]; // The name length
new file[128]; // The file length
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the name length
format(file, sizeof(file), savefolder,pname); // Formatting file
if(!dini_Exists(file)) { // If the file exist
}
else { // if not
dini_IntSet(file, "SS", pSS[playerid]); // This get the pSS
dini_IntSet(file, "Skin", GetPlayerSkin(playerid)); // This get the skin
}
return 1;
}
public OnPlayerConnect(playerid)
{
new pname[128]; // This get's the length of the player name
new file[128]; // This get's the lenght of the file
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
format(file, sizeof(file), savefolder,pname); // This describe's where to save and how to save it
if(!dini_Exists(file)) { // If the file exist
dini_Create(file); // Create the file
dini_IntSet(file, "SS", pSS[playerid]); // Set's "pSS"
dini_IntSet(file, "Skin", 0); // Set's Skin
SetPlayerSkin(playerid, dini_Int(file, "Skin")); // This describes where to load the skin
// and at last this set's the value which were on the file
}
else {
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
// the same thing
}
Код:
COMMAND:sshelp(playerid, params[])
{
if(pInfo[playerid][pSS] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "/ssduty /ssuninvite /showssbadge /quitss (quit SS) /ssr (radio)");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in SS.");
}
return 1;
}
COMMAND:ssuninvite(playerid, params[])
{
new targetid3;
if(sscanf(params, "u", targetid3)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /ssuninvite [PlayerID]");
if(pInfo[targetid3][pSS] >= 1)
{
pInfo[targetid3][pSS] = 0;
SendClientMessage(targetid3, COLOR_YELLOW, "You have been uninvited from SS.");
}
return 1;
}
COMMAND:makessleader(playerid, params[])
{
new targetid1;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an admin");
if(sscanf(params, "u", targetid1)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /makessleader [PlayerID]");
if(pInfo[targetid1][pSS] == 1) return SendClientMessage(playerid, COLOR_RED, "That player is already in SS.");
SetPlayerSkin(targetid1, 294);
pInfo[targetid1][pSS] = 1;
OnPlayerSave(targetid1);
SendClientMessage(targetid1, COLOR_YELLOW, "You have been made the leader of Secret Society.");
return 1;
}
COMMAND:showssbadge(playerid, params[])
{
new targetid1;
if(sscanf(params, "u", targetid1)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /showssbadge [PlayerID]");
if(pInfo[playerid][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not in SS.");
if(pInfo[playerid][pSS] == 1)
{
SendClientMessage(targetid1, COLOR_WHITE, "************************");
SendClientMessage(targetid1, COLOR_BLUE, "Secret Society");
SendClientMessage(targetid1, COLOR_BLUE, "Government Agent");
SendClientMessage(targetid1, COLOR_BLUE, "Los Santos");
SendClientMessage(targetid1, COLOR_WHITE, "************************");
}
return 1;
}
COMMAND:quitss(playerid, params[])
{
if(pInfo[playerid][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not in SS.");
if(pInfo[playerid][pSS] == 1)
pInfo[playerid][pSS] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "You have quitted Secret Society.");
return 1;
}
COMMAND:removefromss(playerid, params[])
{
new targetid2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not an admin");
if(sscanf(params, "u", targetid2)) return SendClientMessage(playerid,COLOR_YELLOW,"Usage: /removefromss [PlayerID]");
if(pInfo[targetid2][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "That player is not in SS.");
else
{
pInfo[targetid2][pSS] = 0;
SendClientMessage(targetid2, COLOR_YELLOW, "You are no longer in Secret Society.");
}
return 1;
}
COMMAND:ssduty(playerid, params[])
{
if(pInfo[playerid][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not in SS!");
if(pInfo[playerid][pSS] == 1)
ShowPlayerDialog(playerid, 8000, DIALOG_STYLE_LIST, "Choose your equipment", "Night Stick\nGrenade\nTear Gas\nSilenced 9mm\nShotgun\nMP5\nM4\nSniper Rifle\nSpray Can\nCamera\nNight Vision Goggles\nThermal Goggles", "Take", "Cancel");
return 1;
}
CMD:sscuff(playerid,params[])
{
if(pInfo[playerid][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not in SS!");
if(pInfo[playerid][pSS] == 1)
if(!sscanf(params, "u", targetid4))
{
SendClientMessage(targetid4, 0xFF0000AA, "* You are now cuffed.");
SetPlayerSpecialAction(targetid4, SPECIAL_ACTION_CUFFED);
SetPlayerAttachedObject(targetid4, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
}
else return SendClientMessage(playerid, 0xFF0000AA, "[ERROR]Usage: /cuff [ID]");
return 1;
}
CMD:ssuncuff(playerid,params[])
{
if(pInfo[playerid][pSS] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not in SS!");
if(pInfo[playerid][pSS] == 1)
if(sscanf(params, "u", cufftarget)) return SendClientMessage(playerid, 0xFF0000AA, "[ERROR] /uncuff [ID] ");
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if(IsPlayerAttachedObjectSlotUsed(cufftarget, i))
{
SetPlayerSpecialAction(cufftarget, SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(cufftarget, i);
}
else return 0;
}
return 1;
}
Just in case that has something to do.. and i get therse errors:
I need to have thorse enums variables i think, because i need to save the pInfo's, just saying incase this makes the errors