Simple admin system -
iPoisonxL - 02.07.2013
Hi, I'm having some trouble with this admin system I'm doing.
Basically, what's it supposed to do is set the said admin's skin on spawn and set his name colour to pink. The problem is, when it sets the skin, sometimes it will freeze you. Since you float for like 0.5 seconds after you spawn, and some of my admins have more lag than others... It was a big problem. I tried to make a timer with it, and pass the playerid variable in the SetTimer function, but then it just set admin to everyone who logged in. Anyway, this might be simpler to see if I give the code here.
here was my first attempt, it would freeze players.
Code:
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "admin1"), true){
SetPlayerSkin(playerid, 249);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "admin2", true)){
SetPlayerSkin(playerid, 93);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "admin3", true)){
SetPlayerSkin(playerid, 30);
SetPlayerColor(playerid, PINK);
}
return 1;
}
Here's my second attempt. It would set everyone admin1.
Code:
//the main forward thingy
forward AdminSpawn(playerid);
//tons of code... lets skip ahead
public OnPlayerSpawn(playerid)
{
//setting the timer with a custom variable being passed through
SetTimerEx("AdminSpawn",3000,false,"i",playerid);
return 1;
}
//tons of code... lets skip ahead
//the timer function
public AdminSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "Shrooms"), true){
SetPlayerSkin(playerid, 249);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "Death", true)){
SetPlayerSkin(playerid, 93);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "Daniel_Fast", true)){
SetPlayerSkin(playerid, 30);
SetPlayerColor(playerid, PINK);
}
}
So, please help. I want to either set the skin when the admin spawns or wait 3 seconds then set the skin. Without any problems. Thanks in advance!
Re: Simple admin system -
iPoisonxL - 03.07.2013
*bump* please help?
Re: Simple admin system -
BigGroter - 03.07.2013
pawn Code:
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "admin1"), true){
SetPlayerSkin(playerid, 249);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "admin2", true)){
SetPlayerSkin(playerid, 93);
SetPlayerColor(playerid, PINK);
} else if (!strcmp(name, "admin3", true)){
SetPlayerSkin(playerid, 30);
SetPlayerColor(playerid, PINK);
}
TogglePlayerControllable(playerid,1); // Just add this, it unfreezes the player.
return 1;
}
Re: Simple admin system -
iPoisonxL - 03.07.2013
Holy, thanks!
Re: Simple admin system -
BigGroter - 03.07.2013
No problem, I suggest using a saving system however, anyone can connect with these names and their skin and color is automatically set.
You could add admin levels as variables, PM me or reply here if you need further help.
Re: Simple admin system -
iPoisonxL - 03.07.2013
Quote:
Originally Posted by BigGroter
No problem, I suggest using a saving system however, anyone can connect with these names and their skin and color is automatically set.
You could add admin levels as variables, PM me or reply here if you need further help. 
|
I'd like to know what's the most efficient saving system library, or if it's simple enough to make my own?
Re: Simple admin system -
BigGroter - 03.07.2013
I'd say y_ini or MySQL, depends on what you prefer. :P
I use MySQL.
Re: Simple admin system -
iPoisonxL - 04.07.2013
Crap, I tried using MySQL with websites before. I haven't had much success. I think I'll try y_ini. Thanks!
Re: Simple admin system -
RedFusion - 04.07.2013
SQLite is easier to set up than MySQL. You could try BUD, it's based on SQLite
https://sampforum.blast.hk/showthread.php?tid=187720