Convert dcmd to zcmd+sscanf
#7

Well the code u updated fixed the error too,

The only problem is, the filterscript says loading.., BUT it does not run, it doesnt show the OnFilterScriptInit texts, this is my fs:

Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <sscanf2>
#include <zcmd>

#define GREY 0xAFAFAFAA
#define GREEN 0x33AA33AA
#define YELLOW 0xFFFF00AA
#define WHITE 0xFFFFFFAA
#define LIGHTBLUE 0x33CCFFAA
#define ORANGE 0xFF9900AA

enum gPInfo
{
	Logged,
	Regged,
	Level,
	Team
};

new PInfo[MAX_PLAYERS][gPInfo];


public OnFilterScriptInit()
{

	GameTextForAll("gAdmin loaded!", 2000, 5);
	SendClientMessageToAll(ORANGE, "gAdmin loaded!");
	print("gAdmin loaded!");
	print("\n--------------------------------------");
	print(" GingeDevil Admin Script Loaded!		   ");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	GameTextForPlayer(playerid, "Welcome to GingeDevil RP!", 2000, 5);
	PInfo[playerid][Logged] = 0;
	PInfo[playerid][Regged] = 0;
	PInfo[playerid][Level] = 0;
	PInfo[playerid][Team] = 0;
	new n[MAX_PLAYER_NAME], file[256];
	GetPlayerName(playerid,n,sizeof(n));
	format(file,sizeof(file),"gAdmin/Users/%s.txt",n);
	if(dini_Exists(file))
	{
 		print("Code pos #1");
		SendClientMessage(playerid,LIGHTBLUE,"You are registered, Please /login!");
		PInfo[playerid][Regged] = 1;
		PInfo[playerid][Logged] = 0;
		return 1;
	}
	if(!dini_Exists(file))
	{
 		print("Code pos #2");
 		SendClientMessage(playerid,LIGHTBLUE,"You are not registered, Please /register!");
		PInfo[playerid][Regged] = 0;
		PInfo[playerid][Logged] = 0;
		return 1;
	}

	if(PInfo[playerid][Team] == 1)
	{
		SetPlayerColor(playerid, GREEN);
		return 1;
	}
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

	new n[MAX_PLAYER_NAME], file[256];
	GetPlayerName(playerid,n,sizeof(n));
	format(file,sizeof(file),"gAdmin/Users/%s.txt",n);
	PInfo[playerid][Logged] = 0;
 	if(dini_Exists(file))
  		{
    	print("Code pos #3");
  		dini_IntSet(file,"Logged",0);
   		return 1;
    	}
	return 1;
}
CMD:me(playerid, params[])
	{
		new string[128],msg[128],pname[MAX_PLAYER_NAME];
		GetPlayerName(playerid,pname,sizeof(pname));
		if(sscanf(params,"sz",msg)) return SendClientMessage(playerid,ORANGE, "USAGE: /me <text>");
		format(string,sizeof(string),"*%s %s",pname,msg);
		SendClientMessageToAll(GREY,string);
		return 1;
	}
	
CMD:kick(playerid, params[])
	{
	new string[128], id, reason, name[MAX_PLAYER_NAME];
 	if(sscanf(params, "us[100]",id, reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /kick <playerid/partofname> <reason>");
 	if(PInfo[playerid][Level] >= 3) return SendClientMessage(playerid, ORANGE, "You're not an admin.");
	Kick(id);
	GetPlayerName(id, name, sizeof(name));
	format(string, sizeof(string), "%s has been kicked of the server. Reason: %s", name, reason);
	SendClientMessageToAll(ORANGE, string);
	return 1;
}

CMD:promote(playerid, params[])
{
	new level,id,file[256],n[MAX_PLAYER_NAME];//creating the new variabls
	new tmp[256], tmp2[256], Index,str[50];// creating the new variables
	tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);// setting them to strtok so we can use them as parameters of our command
	GetPlayerName(id,n,MAX_PLAYER_NAME);//getting the players name
	format(file,sizeof(file),"gAdmin/Users/%s.txt",n);//formatting the file
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");//if the player is not rcon admin
	if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");// if the string is empty
	if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID"); //if the id is not connected
	PInfo[id][Level] = level;//sets the level of the player
		dini_IntSet(file,"Level",level);//saves the new level to the file
		format(str,sizeof(str),"You have set %s's level to %d",n,level);//creates the string
		SendClientMessage(playerid,LIGHTBLUE,str);
		return 1;
}*/
/*
CMD:test( playerid, params[ ])
{
	print("Working");
    new id;
    id = strval( params );
    return SendClientMessage( id, 0xAAAAAA, "Test" );
}*/

CMD:setlevel(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, GREY, "You are not an RCON admin!");

    new
        pLevel,
        pID
    ;

    if(sscanf(params, "dd", pID, pLevel)) return SendClientMessage(playerid, GREY, "USAGE: /setlevel <ID> <Level>");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, GREY, "You have entered an incorrect ID");

    new
        pName[MAX_PLAYER_NAME],
        file[56]
    ;

    GetPlayerName(pID, pName, sizeof(pName));

    format(file, sizeof(file), "gAdmin/Users/%s.txt", pName);

    PInfo[pID][Level] = pLevel;
    dini_IntSet(file, "Level", pLevel);

    format(file, sizeof(file), "You have set %s's level to %d", pName, pLevel);
    SendClientMessage(playerid, LIGHTBLUE, file);
    return 1;
}
Reply


Messages In This Thread
Convert dcmd to zcmd+sscanf - by luckie12 - 28.03.2016, 17:53
Re: Convert dcmd to zcmd+sscanf - by ]Rafaellos[ - 28.03.2016, 18:10
Re: Convert dcmd to zcmd+sscanf - by luckie12 - 28.03.2016, 18:13
Re: Convert dcmd to zcmd+sscanf - by iKevin - 28.03.2016, 18:16
Re: Convert dcmd to zcmd+sscanf - by luckie12 - 28.03.2016, 18:21
Re: Convert dcmd to zcmd+sscanf - by ]Rafaellos[ - 28.03.2016, 18:23
Re: Convert dcmd to zcmd+sscanf - by luckie12 - 28.03.2016, 18:27
Re: Convert dcmd to zcmd+sscanf - by iKevin - 28.03.2016, 19:31
Re: Convert dcmd to zcmd+sscanf - by luckie12 - 28.03.2016, 19:59
Re: Convert dcmd to zcmd+sscanf - by iKevin - 28.03.2016, 20:03

Forum Jump:


Users browsing this thread: 1 Guest(s)