How can i make my server remember the skin REP - 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)
+--- Thread: How can i make my server remember the skin REP (
/showthread.php?tid=331221)
How can i make my server remember the skin REP -
Scripter12345 - 04.04.2012
Hello, when i do /adminduty my skins changes to a certain ID but what i want is when i do /adminduty again to go off duty i wnat my skins to go back to what it was before i went on duty.
Код:
CMD:adminduty(playerid, params[])
{
if(PlayerData[ID][AdminLevel] >= 1)
{
if(AdminDuty[playerid]) //if they are already in admin duty
{
AdminDuty[playerid] = false; //Set the AdminDuty variable to false
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,0);
SetPlayerColor(playerid, 0xFFFFFFFF); //Set their color to white
SendClientMessage(playerid, -1, "Admin duty set {FF0000}OFF!"); //Inform them about the duty change
}
else //If they are not on admin duty
{
AdminDuty[playerid] = true; //Set the AdminDuty variable to true
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
SetPlayerSkin(playerid,82);
SetPlayerColor(playerid, 0xFF0000FF); //Set their color to red
SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!"); //Inform them about the duty change
}
}
else return SendClientMessage(playerid, COLOR_RED, "You have to be level 1 to use this command!"); //if he isn't allowed to use this command, send him this message
return 1;
}
Please Help I Will Rep
Re: How can i make my server remember the skin REP -
Steven82 - 04.04.2012
pawn Код:
new gAdminSkin[MAX_PLAYERS]; // add at top of script, and remember when the player disconnects set this to 0.
CMD:adminduty(playerid, params[])
{
if(PlayerData[ID][AdminLevel] >= 1)
{
if(AdminDuty[playerid])
{
AdminDuty[playerid] = false;
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,0);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerSkin(playerid, gAdminSkin[playerid]); // sets the old skin back
gAdminSkin[playerid] = 0; // clears the old skin variable(need to have this)
SendClientMessage(playerid, -1, "Admin duty set {FF0000}OFF!");
}
else
{
AdminDuty[playerid] = true;
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
SetPlayerSkin(playerid,82);
SetPlayerColor(playerid, 0xFF0000FF);
gAdminSkin[playerid] = GetPlayerSkin(playerid); // stores the skin id in the variable so you can use it later on.
SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!");
}
}
else return SendClientMessage(playerid, COLOR_RED, "You have to be level 1 to use this command!"); //if he isn't allowed to use this command, send him this message
return 1;
}
Note: This will not save the players old skin if they disconnect while under admin duty.
Re: How can i make my server remember the skin REP -
Scripter12345 - 04.04.2012
Quote:
Originally Posted by Steven82
pawn Код:
new gAdminSkin[MAX_PLAYERS]; // add at top of script, and remember when the player disconnects set this to 0.
CMD:adminduty(playerid, params[]) { if(PlayerData[ID][AdminLevel] >= 1) { if(AdminDuty[playerid]) { AdminDuty[playerid] = false; SetPlayerHealth(playerid,100); SetPlayerArmour(playerid,0); SetPlayerColor(playerid, 0xFFFFFFFF); SetPlayerSkin(playerid, gAdminSkin[playerid]); // sets the old skin back gAdminSkin[playerid] = 0; // clears the old skin variable(need to have this) SendClientMessage(playerid, -1, "Admin duty set {FF0000}OFF!"); } else { AdminDuty[playerid] = true; SetPlayerHealth(playerid,99999); SetPlayerArmour(playerid,99999); SetPlayerSkin(playerid,82); SetPlayerColor(playerid, 0xFF0000FF); gAdminSkin[playerid] = GetPlayerSkin(playerid); // stores the skin id in the variable so you can use it later on. SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!"); } } else return SendClientMessage(playerid, COLOR_RED, "You have to be level 1 to use this command!"); //if he isn't allowed to use this command, send him this message return 1; }
Note: This will not save the players old skin if they disconnect while under admin duty.
|
So will this do this ?
Login > Skin ID 5 ( Example ) > /adminduty ( You automatically go to a different skin ) > /adminduty (Off admin duty ) > Back to Skin ID 5
Please Help
Re: How can i make my server remember the skin REP -
Steven82 - 04.04.2012
Are you serious?
Yes i explained the code in the most brief way i could. Yes it'll save it. Jesus christ, quit scripting by copying and pasting shit. It's getting old.