02.07.2013, 14:17
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.
Here's my second attempt. It would set everyone admin1.
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!
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; }
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); } }