[HELP] Filterscript not saving.
#1

Right basically. This is a filterscript that basically, cuts down MG, and disables you seeing someones name above their heads and it is not saving?

Код:
#include <a_samp>
#include <djson>
#include <sscanf2>
#include <zcmd>

#undef MAX_PLAYERS
#define MAX_SLOTS   500

#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED   0xFF0000AA
#define COLOR_GREEN 0x00FF00AA
#define COLOR_GRAY  0xAFAFAFAA

new playerName[MAX_SLOTS][MAX_PLAYER_NAME],
	bool:playerKnowPlayer[MAX_SLOTS][MAX_SLOTS],
	pMeetRequest[MAX_SLOTS], Text3D:playerID[MAX_SLOTS]
;

public OnFilterScriptInit()
{
	for(new i = 0; i < MAX_SLOTS; i++)
	{
	    for(new j = 0; j < MAX_SLOTS; j++)
	    {
			ShowPlayerNameTagForPlayer(i, j, false);
		}
	}
	djson_GameModeInit();
	return 1;
}

public OnFilterScriptExit()
{
	djson_GameModeExit();
	return 1;
}

public OnPlayerConnect(playerid)
{
	new uStr[35];
	GetPlayerName(playerid, playerName[playerid], MAX_PLAYER_NAME);
	
 	format(uStr, 35, "PKP/%s.ini", playerName[playerid]);
 	if(!fexist(uStr)) djCreateFile(uStr);

	for(new i = 0; i < MAX_SLOTS; i++)
	{
	    if(!IsPlayerConnected(i)) continue;
		if(djInt(uStr, playerName[i]) == 1)
		{
			playerKnowPlayer[playerid][i] = true;
			playerKnowPlayer[i][playerid] = true;
			ShowPlayerNameTagForPlayer(playerid, i, true);
			ShowPlayerNameTagForPlayer(i, playerid, true);
		}
		else
		{
			djSetInt(uStr, playerName[i], 0);
 			ShowPlayerNameTagForPlayer(playerid, i, false);
			ShowPlayerNameTagForPlayer(i, playerid, false);
		}
	}
	pMeetRequest[playerid] = -1;
	
	format(uStr, 35, "%d", playerid);
	playerID[playerid] = Create3DTextLabel(uStr, 0x00FF00AA, 0.0, 0.0, 0.0, 15, -1, 1);
	return 1;
}

public OnPlayerDisconnect(playerid)
{
	new uStr[35];
 	format(uStr, 35, "PKP/%s.ini", playerName[playerid]);
 	if(!fexist(uStr)) djCreateFile(uStr);

	for(new i = 0; i < MAX_SLOTS; i++)
	{
		playerKnowPlayer[playerid][i] = false;
		playerKnowPlayer[i][playerid] = false;
		ShowPlayerNameTagForPlayer(playerid, i, false);
		ShowPlayerNameTagForPlayer(i, playerid, false);
	}
	pMeetRequest[playerid] = -1;
	Delete3DTextLabel(playerID[playerid]);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	Attach3DTextLabelToPlayer(playerID[playerid], playerid, 0.0, 0.0, 1.5);
	return 1;
}

public OnPlayerText(playerid, text[])
{
	new Float:pPos[3], str[128];
	GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
	for(new i = 0; i < MAX_SLOTS; i++)
	{
	    if(!IsPlayerConnected(i) || i == playerid || !IsPlayerInRangeOfPoint(i, 15, pPos[0], pPos[1], pPos[2])) continue;
	    if(playerKnowPlayer[i][playerid])
		{
		    format(str, 128, "%s: %s", playerName[playerid], text);
		    SendClientMessage(i, COLOR_WHITE, str);
		}
		else
		{
		    format(str, 128, "Person: %s", text);
		    SendClientMessage(i, COLOR_WHITE, str);
		}
	}
	format(str, 128, "You: %s", text);
	SendClientMessage(playerid, COLOR_WHITE, str);
	return 0;
}

CMD:meetperson(playerid, params[])
{
	new Float:pPos[3], pId, str[128];
	if(sscanf(params, "u", pId)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /meetp(erson) [playerid]");
	if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, COLOR_GRAY, "* That player is not connected to the server");
	GetPlayerPos(pId, pPos[0], pPos[1], pPos[2]);
	if(!IsPlayerInRangeOfPoint(playerid, 3, pPos[0], pPos[1], pPos[2])) return SendClientMessage(playerid, COLOR_RED, "* You should stand near the person");
	if(playerKnowPlayer[playerid][pId]) return SendClientMessage(playerid, COLOR_RED, "What silly! You know him/her already...");
	if(pMeetRequest[playerid] == pId) return SendClientMessage(playerid, COLOR_GRAY, "Wait for his/her answer!");
	if(pMeetRequest[playerid] != -1) return SendClientMessage(playerid, COLOR_RED, "You can't talk to two persons at once, can you?");
	if(pMeetRequest[pId] != -1) return SendClientMessage(playerid, COLOR_RED, "Can't you see that he/she is already talking to someone? Tsss...");
	pMeetRequest[pId] = playerid;
	pMeetRequest[playerid] = pId;
	format(str, 128, "Person: Hi! I am %s. I would like to know you better, what's your name?", playerName[playerid]);
	SendClientMessage(pId, COLOR_WHITE, str);
	SendClientMessage(pId, COLOR_GRAY, "Walk away to ignore this, or use /fckoff. Use /acceptm(eeting) to tell your name");
	format(str, 128, "You: Hi! I am %s. I would like to know you better, what's your name?", playerName[playerid]);
	SendClientMessage(playerid, COLOR_WHITE, str);
	SendClientMessage(playerid, COLOR_GRAY, "Wait for his/her answer or use /cancelm(eeting)");
	return 1;
}

CMD:fckoff(playerid, params[])
{
	new str[128];
	if(pMeetRequest[playerid] == -1) return SendClientMessage(playerid, COLOR_GRAY, "You are currently not meeting someone.");
	format(str, 128, "Person: Well %s, FUCK OFF.", playerName[pMeetRequest[playerid]]);
	SendClientMessage(pMeetRequest[playerid], COLOR_RED, str);
	format(str, 128, "You: Well %s, FUCK OFF.", playerName[pMeetRequest[playerid]]);
	SendClientMessage(playerid, COLOR_RED, str);
	SendClientMessage(playerid, COLOR_GRAY, "Meeting denied.");
	SendClientMessage(pMeetRequest[playerid], COLOR_GRAY, "Well, he/she clearly doesn't wanna tell his/her name.");
	pMeetRequest[playerid] = -1;
	pMeetRequest[pMeetRequest[playerid]] = -1;
	return 1;
}

CMD:cancelmeeting(playerid, params[])
{
	if(pMeetRequest[playerid] == -1) return SendClientMessage(playerid, COLOR_GRAY, "You are currently not meeting someone.");
	SendClientMessage(pMeetRequest[playerid], COLOR_GRAY, "Person: You know what, never mind.");
	SendClientMessage(playerid, COLOR_GRAY, "You: You know what, never mind.");
	pMeetRequest[playerid] = -1;
	pMeetRequest[pMeetRequest[playerid]] = -1;
	return 1;
}

CMD:acceptmeeting(playerid, params[])
{
	new str[128], uStr[35];
	if(pMeetRequest[playerid] == -1) return SendClientMessage(playerid, COLOR_GRAY, "You are currently not meeting someone.");
	format(str, 128, "Person: Hi %s. I am %s. Nice to meet you", playerName[pMeetRequest[playerid]], playerName[playerid]);
	SendClientMessage(pMeetRequest[playerid], COLOR_GREEN, str);
	format(str, 128, "You: Hi %s. I am %s. Nice to meet you", playerName[pMeetRequest[playerid]], playerName[playerid]);
	SendClientMessage(playerid, COLOR_GREEN, str);
	playerKnowPlayer[playerid][pMeetRequest[playerid]] = true;
	playerKnowPlayer[pMeetRequest[playerid]][playerid] = true;
	format(uStr, 35, "PKP/%s.ini", playerName[playerid]);
	djSetInt(uStr, playerName[pMeetRequest[playerid]], 1);
	format(uStr, 35, "PKP/%s.ini", playerName[pMeetRequest[playerid]]);
	djSetInt(uStr, playerName[playerid], 1);
	ShowPlayerNameTagForPlayer(playerid, pMeetRequest[playerid], true);
	ShowPlayerNameTagForPlayer(pMeetRequest[playerid], playerid, true);
	pMeetRequest[playerid] = -1;
	pMeetRequest[pMeetRequest[playerid]] = -1;
	return 1;
}

CMD:acceptm(playerid, params[]) return cmd_acceptmeeting(playerid, params);
CMD:cancelm(playerid, params[]) return cmd_cancelmeeting(playerid, params);
CMD:meetp(playerid, params[]) return cmd_meetperson(playerid, params);
Reply
#2

Try to explain it a little bit, what is not saving?
Reply
#3

For example. The script is... /meetperson ID. I've done that. They logout, then log back in. Then I have to do /meetperson all over again?
Reply
#4

Use dini to save a variable like... in a file Meet_Matthew_Striker, and inside the names of the person he knows.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)