How to make army rights - killdahobo99 - 19.08.2009
Since my last post was deleted for no reason at all (well for a stupid reason, after i finally get some posts to help me) Heres my new one I hope this one is "a proper subject"
If someone trys to select the army skin during the class selection it says "you do not have the right to use the army skin" and if doesnt let them choose it.
If an admin thinks a player can be army, the admin can go to the users .dudb file (this is how i save my users stats) and it will say something like "Canusearmy = 0" Meaning the player cannot use the army skin, and if the admin sets it to "Canusearmy = 1" the player can now use army.
This is what i need help with, How can i do this? can someone do it for me or show me how?
Heres my login/register:
http://pastebin.com/m4a4cafa8
Heres my GM:
http://pastebin.com/m7802087e
Re: How to make army rights -
snoob - 19.08.2009
contact me on msn i have a solution for u, here is a link to test.
http://www.studio2015.ca/tmp.amx
with the modification i just made you can use as rcon admin /armyok ID
this will store the name of the player in a file named
armyok.txt in your scriptfiles folder
that file can be edited with notepad...
see ya
Re: How to make army rights -
coole210 - 19.08.2009
Try this, instead of 0 Put GetPlayerRights [function below]
and an easy command (/giverights)
pawn Код:
// BOTTOM OF SCRIPT
stock GetPlayerRights(playerid)
{
return CanUseArmy[playerid];
}
pawn Код:
//OnPlayerCommandText
if(strcmp(cmd,"/giverights",true) == 0) if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /giverights [playerid]");
new giveplayerid = strval(tmp);
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
GetPlayerName(playerid,sendername,sizeof(sendername));
new string[128];
format(string,sizeof(string),"[ ! ] You can now choose the army skin thanks to administrator %s",sendername);
SendClientMessage(giveplayerid,COLOR,string);
format(string,sizeof(string),"[ ! ] You have given %s rights to wear army skin",giveplayer);
SendClientMessage(playerid,COLOR,string);
CanUseArmy[giveplayerid] = 1;
return 1;
}
if(strcmp(cmd,"/removerights",true) == 0) if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /removerights [playerid]");
new giveplayerid = strval(tmp);
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
GetPlayerName(playerid,sendername,sizeof(sendername));
new string[128];
format(string,sizeof(string),"[ ! ] Your rights for army has been reset by %s !",sendername);
SendClientMessage(giveplayerid,COLOR,string);
format(string,sizeof(string),"[ ! ] You have removed %s rights to wear army skin",giveplayer);
SendClientMessage(playerid,COLOR,string);
SendClientMessage(giveplayerid,COLOR,"[ ! ] You are kicked !");
Kick(giveplayerid);
CanUseArmy[giveplayerid] = 0;
return 1;
}
Re: How to make army rights -
Calgon - 19.08.2009
Quote:
Originally Posted by [TPG
Coole210 ]
Try this, instead of 0 Put GetPlayerRights [function below]
and an easy command (/giverights)
pawn Код:
// BOTTOM OF SCRIPT stock GetPlayerRights(playerid) { return CanUseArmy[playerid]; }
pawn Код:
//OnPlayerCommandText if(strcmp(cmd,"/giverights",true) == 0) if(IsPlayerAdmin(playerid)) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /giverights [playerid]"); new giveplayerid = strval(tmp); new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); GetPlayerName(playerid,sendername,sizeof(sendername)); new string[128]; format(string,sizeof(string),"[ ! ] You can now choose the army skin thanks to administrator %s",sendername); SendClientMessage(giveplayerid,COLOR,string); format(string,sizeof(string),"[ ! ] You have given %s rights to wear army skin",giveplayer); SendClientMessage(playerid,COLOR,string); CanUseArmy[giveplayerid] = 1; return 1; } if(strcmp(cmd,"/removerights",true) == 0) if(IsPlayerAdmin(playerid)) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /removerights [playerid]"); new giveplayerid = strval(tmp); new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); GetPlayerName(playerid,sendername,sizeof(sendername)); new string[128]; format(string,sizeof(string),"[ ! ] Your rights for army has been reset by %s !",sendername); SendClientMessage(giveplayerid,COLOR,string); format(string,sizeof(string),"[ ! ] You have removed %s rights to wear army skin",giveplayer); SendClientMessage(playerid,COLOR,string); SendClientMessage(giveplayerid,COLOR,"[ ! ] You are kicked !"); Kick(giveplayerid); CanUseArmy[giveplayerid] = 0; return 1; }
|
However, this doesn't save after a GMX or whatever.. Just an FYI.
Re: How to make army rights - killdahobo99 - 19.08.2009
Quote:
Originally Posted by [TPG
Coole210 ]
Try this, instead of 0 Put GetPlayerRights [function below]
and an easy command (/giverights)
pawn Код:
// BOTTOM OF SCRIPT stock GetPlayerRights(playerid) { return CanUseArmy[playerid]; }
pawn Код:
//OnPlayerCommandText if(strcmp(cmd,"/giverights",true) == 0) if(IsPlayerAdmin(playerid)) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /giverights [playerid]"); new giveplayerid = strval(tmp); new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); GetPlayerName(playerid,sendername,sizeof(sendername)); new string[128]; format(string,sizeof(string),"[ ! ] You can now choose the army skin thanks to administrator %s",sendername); SendClientMessage(giveplayerid,COLOR,string); format(string,sizeof(string),"[ ! ] You have given %s rights to wear army skin",giveplayer); SendClientMessage(playerid,COLOR,string); CanUseArmy[giveplayerid] = 1; return 1; } if(strcmp(cmd,"/removerights",true) == 0) if(IsPlayerAdmin(playerid)) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /removerights [playerid]"); new giveplayerid = strval(tmp); new giveplayer[MAX_PLAYER_NAME]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer)); GetPlayerName(playerid,sendername,sizeof(sendername)); new string[128]; format(string,sizeof(string),"[ ! ] Your rights for army has been reset by %s !",sendername); SendClientMessage(giveplayerid,COLOR,string); format(string,sizeof(string),"[ ! ] You have removed %s rights to wear army skin",giveplayer); SendClientMessage(playerid,COLOR,string); SendClientMessage(giveplayerid,COLOR,"[ ! ] You are kicked !"); Kick(giveplayerid); CanUseArmy[giveplayerid] = 0; return 1; }
|
This is great! but the problem is i need to make it so it reads from the players .dudb file. I already have a login/register system (i posted up there) I need to make it so it reads from the file and if it's 0 in the file then they cant play.
These commands work and all, but when the server restarts, the player is not army any more.
Re: How to make army rights -
coole210 - 19.08.2009
pawn Код:
stock GivePlayerRights(playerid, rights)
{
CanUseArmy[playerid] = CanUseArmy[playerid] + rights;
return CanUseArmy[playerid];
}
pawn Код:
//onplayerdisc
dUserSetINT(PlayerName(playerid)).("Rights",GetPlayerRights(playerid));
pawn Код:
// /LOGIN
GivePlayerRights(playerid,dUserINT(PlayerName(playerid)).("Rights")-GetPlayerRights(playerid));
Re: How to make army rights -
Hoss - 17.10.2010
Nice job killdahobo
Re: How to make army rights -
CrucixTM - 17.10.2010
also
pawn Код:
// OnPlayerRequestSpawn:
if(GetPlayerSkin(playerid) == (army skin) && !CanUseArmy[playerid]) return 0;
done.
EDIT: Or if you can't get the players skin here, make a new array named "cID[MAX_PLAYERS]", and OnPlayerRequestClass, do "cID[playerid] == classid" - cID[playerid] will store the class ID and you can just check what ID that is in OnPlayerRequestSpawn instead of GetPlayerSkin.