SA-MP Forums Archive
Set Player To Use FilterScript - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Set Player To Use FilterScript (/showthread.php?tid=158801)



Set Player To Use FilterScript - Hal - 11.07.2010

I am using an Edit of Breadfish's object editor /https://sampforum.blast.hk/showthread.php?tid=79035/ and i want to be able to; as an admin ( no admin FS, im sticking with RCON as nothing more it needed) to do /makemapper [id] . i have tried with other script bits, that do the same function like /makecop. I would add the command along with admin FS, but i do not want to use one.

SO, what i need is a small thing; so that i can set people to use the object editor because it is currently IsPlayerAdmin, and i do not feel good with giving people my RCON password :P

Anything Would Be Appreciated! THANKS


Re: Set Player To Use FilterScript - (S)Toril - 11.07.2010

I suppose that you could try the following.

Create a global variable "
Код:
new tempmapper[MAX_PLAYERS];
"

Then create a command to set the variable on the player from 0 to 1.

(Dcmd as default)
Код:
dcmd_makemapper(playerid,params[])
{
if(IsPlayerAdmin,playerid)
if(!strlen(params)) {
SendClientMessage(playerid,color,"Usage: /makemapper [player]");
return 1;
}
tempmapper[params] 1;
return 1;
}
Then on the command to start object editing just check if the player is a temporary mapper.


(Code might be dodgy)


Re: Set Player To Use FilterScript - Hal - 11.07.2010

Thanks ill try it out!


Re: Set Player To Use FilterScript - Hal - 12.07.2010

Quote:
Originally Posted by (S)Toril
Посмотреть сообщение
I suppose that you could try the following.

Create a global variable "
Код:
new tempmapper[MAX_PLAYERS];
"

Then create a command to set the variable on the player from 0 to 1.

(Dcmd as default)
Код:
dcmd_makemapper(playerid,params[])
{
if(IsPlayerAdmin,playerid)
if(!strlen(params)) {
SendClientMessage(playerid,color,"Usage: /makemapper [player]");
return 1;
}
tempmapper[params] 1;
return 1;
}
Then on the command to start object editing just check if the player is a temporary mapper.


(Code might be dodgy)
So, this is a temp only, so it has to be set everytime they log on? - how would i edit it so that the names are saved?


Re: Set Player To Use FilterScript - PotH3Ad - 12.07.2010

Give this a try, should work...

pawn Код:
//Top of Script
new mfile[90];

dcmd_makemapper(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, color, "You are not an RCON admin!");
    if(!strlen(params)) return SendClientMessage(playerid, color, "Usage: /makemapper [player]");

    new Target = strval(params);
    if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid, color, "Player not found.");

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(Target, pName, sizeof(pName));

    format(mfile, sizeof(mfile), "mappers.ini");
    if(!dini_Exists(mfile)) dini_Create(mfile);
    dini_IntSet(mfile, pName, 1);
    return 1;
}

stock IsPlayerAMapper(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    format(mfile, sizeof(mfile), "mappers.ini");
    if(dini_Int(mfile, pName) == 1) return 1;
    return 0;
}

//Under mapping commands add this
if(!IsPlayerAMapper(playerid)) return SendClientMessage(playerid, color, "You are not a mapper!");