Save thingy, please help. I really need this.
#1

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;
}
}






Reply
#2

someone?
Reply
#3

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.
Reply
#4

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
Reply
#5

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.
Reply
#6

Ah, damn. Can you please make something for me?
I can't get it workthis is so important for me :P
Reply
#7

I PM'ed you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)