Save thingy, please help. I really need this. -
bartje01 - 01.02.2010
Hey, I have a script.But I want to save it everytime.
The script just works, but I now want to save it. IT is an script that give permission to use the cop skins.
Now I want that if you relog you still have the permission to spawn with the cop skins.
Can someone give an example or something on how to do this please?
new bool:SkinPermission[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SkinPermission[playerid] = false;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SkinPermission[playerid] = false;
return 1;
}
public OnPlayerSpawn(playerid)
{
SkinPermission[playerid] = false;
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],
idx;
cmd = strtok(cmdtext, idx);
}
if(strcmp(cmd, "/givepermission", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new tmp[128];
new giveplayerid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /givepermission [playerid]");
giveplayerid = strval(tmp);
if(IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREEN, "Done!");
SkinPermission[giveplayerid] = true;
}
else if (!IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREEN, "ERROR: Player not Conected!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not an Administrator!");
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
{
new Skin;
Skin = GetPlayerSkin(playerid);
if(Skin == 280)
{
if(SkinPermission[playerid] == false)
{
GameTextForPlayer(playerid,"~w~You don't have permission for this skin",3000,5);
return 0;
}
}
Re: Save thingy, please help. I really need this. -
bartje01 - 02.02.2010
someone?
Re: Save thingy, please help. I really need this. -
Perker12345 - 02.02.2010
Dont you have anything like this in your script?
Add it into your pEnum and then search for something like this =
format(var, 32, "Skinpermission=%d\n",PlayerInfo[playerid][pSkinPermission]);fwrite(hFile, var);
It will then save it into their userfiles, ofc it depends on what gamemode you are using if it has any saving thing.
Re: Save thingy, please help. I really need this. -
bartje01 - 02.02.2010
Well, I have this
// Enums
enum PlayerData {
Registered,
LoggedIn,
Level,
Muted,
Caps,
Jailed,
JailTime,
Frozen,
FreezeTime,
Kills,
Deaths,
MuteWarnings,
Warnings,
Spawned,
TimesSpawned,
God,
DoorsLocked,
Invis,
AllowPing,
Spam
};
enum ServerData {
MaxPing,
ReadPMs,
ReadCmds,
MaxAdminLevel,
AdminOnlySkins,
AdminSkin,
NameKick,
AntiBot,
AntiSpam,
AntiSwear,
NoCaps,
Locked
};
new PlayerInfo[MAX_PLAYERS][PlayerData];
new ServerInfo[ServerData];
new Float:Pos[MAX_PLAYERS][4];
But where should I put your line then? :P
Re: Save thingy, please help. I really need this. -
Perker12345 - 02.02.2010
Yeah, all that is being saved/created somewhere else in your script
It should be on one of these publics.
OnPlayerDataSave
OnPlayerUpdate
OnPlayerLogin
OnPlayerRegister
Then look for some lines that looks like the one i wrote before, thats where the info gets saved.
Re: Save thingy, please help. I really need this. -
bartje01 - 02.02.2010
Ah, damn. Can you please make something for me?
I can't get it workthis is so important for me :P
Re: Save thingy, please help. I really need this. -
Perker12345 - 02.02.2010
I PM'ed you.