PDA

View Full Version : Really confused how to do this..... REP


Scripter12345
04/04/2012, 02:01 AM
I have made it so when you do /adminduty your skin changes and what im trying to do is when you do /adminduty again to go off duty i want my skin to go back to what it was before i went on duty


I have tried but this is not working


CMD:skin(playerid, params[])
{
PlayerInfo[playerid][pSkin] = 1;
SetPlayerSkin(playerid, 3);
SendClientMessage(playerid, COLOR_GOLD, "Skin changed");
return 1;
}


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
GetPlayerSkin(playerid);
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 Please

Reklez
04/04/2012, 02:03 AM
put this when player is on duty code
remove that GetPlayerSkin and replace with this


new OldSkin = GetPlayerSkin(playerid);


then on player off duty put this


SetPlayerSkin(playerid, OldSkin);

Scripter12345
04/04/2012, 02:14 AM
put this when player is on duty code
remove that GetPlayerSkin and replace with this


new OldSkin = GetPlayerSkin(playerid);


then on player off duty put this


SetPlayerSkin(playerid, OldSkin);



I put that in and it still dont work


May you please try and put it in please


Please Help Please

Reklez
04/04/2012, 02:18 AM
first off all i'm getting crazy on your code so i make it simple


CMD:adminduty(playerid, params[])
{
if(PlayerData[ID][AdminLevel] >= 1)
{
if(AdminDuty[playerid] == 0) //if admin is off duty
{
AdminDuty[playerid] = 1;
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
new OldSkin = GetPlayerSkin(playerid);
SetPlayerSkin(playerid,82);
SetPlayerColor(playerid, 0xFF0000FF);
SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!");
}
else if(AdminDuty[playerid] == 1) //if admin is on duty
{
AdminDuty[playerid] = 0;
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,0);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerSkin(playerid, OldSkin);
SendClientMessage(playerid, -1, "Admin duty set {FF0000}OFF!");
}
}
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;
}

Scripter12345
04/04/2012, 02:22 AM
first off all i'm getting crazy on your code so i make it simple


CMD:adminduty(playerid, params[])
{
if(PlayerData[ID][AdminLevel] >= 1)
{
if(AdminDuty[playerid] == 0) //if admin is off duty
{
AdminDuty[playerid] = 1;
SetPlayerHealth(playerid,99999);
SetPlayerArmour(playerid,99999);
new OldSkin = GetPlayerSkin(playerid);
SetPlayerSkin(playerid,82);
SetPlayerColor(playerid, 0xFF0000FF);
SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!");
}
else if(AdminDuty[playerid] == 1) //if admin is on duty
{
AdminDuty[playerid] = 0;
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,0);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerSkin(playerid, OldSkin);
SendClientMessage(playerid, -1, "Admin duty set {FF0000}OFF!");
}
}
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;
}



Now im getting this error


error 017: undefined symbol "OldSkin"


On this line


SetPlayerSkin(playerid, OldSkin);


Please Help Please

Reklez
04/04/2012, 02:27 AM
SetPVarInt(playerid, "OldSkin", GetPlayerSkin(playerid)); //replace new OldSkin with this


then put on the code where admin duty sets off


SetPlayerSkin(playerid, GetPVarInt(playerid, "OldSkin"));

Kar
04/04/2012, 02:32 AM
CMD:adminduty(playerid, params[])
{
if(PlayerData[ID][AdminLevel] == 0) 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
if(AdminDuty[playerid]) //if they are already in admin duty
{
AdminDuty[playerid] = false; //Set the AdminDuty variable to false
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 0.0);
SetPlayerColor(playerid, 0xFFFFFFFF); //Set their color to white
SetPVarInt(playerid, "AD_Skin", GetPlayerSkin(playerid));
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.0);
SetPlayerArmour(playerid, 99999.0);
SetPlayerSkin(playerid, GetPVarInt(playerid, "AD_Skin"));
DeletePVar(playerid, "AD_Skin");
SetPlayerColor(playerid, 0xFF0000FF); //Set their color to red
SendClientMessage(playerid, -1, "Admin duty set {00FF00}ON!"); //Inform them about the duty change
}
return 1;
}

Scripter12345
04/04/2012, 02:50 AM
It still does not work is there any other bit of code you need to see ?

Steven82
04/04/2012, 02:52 AM
DUDE, seriously. I gave you the code for this and the topic got deleted i think?

And now these guys are giving you correctly working code, and your still getting errors. Time to quit copying and pasting and learning how to script/fix errors.

Scripter12345
04/04/2012, 02:54 AM
DUDE, seriously. I gave you the code for this and the topic got deleted i think?

And now these guys are giving you correctly working code, and your still getting errors. Time to quit copying and pasting and learning how to script/fix errors.


Or maybe im learning scripting and im asking for help and maybe you need to stop flaming.


Im learning now get off.

Reklez
04/04/2012, 02:55 AM
Seriously, you need to learn scripting, sometimes in your life you need to learn, ENOUGH for copy/pasting.

Steven82
04/04/2012, 02:59 AM
I'm not flaming, it's just annoying that you keep posting that their/my coding didn't work. Which infact, it does.

ReneG
04/04/2012, 03:07 AM
Just so you know. Being a copypasta is not scripting. It isn't rocket science to ****** errors and learn why they occur.

[ABK]Antonio
04/04/2012, 04:28 AM
Instead of you people ganging up on him...You can simply do something like this...



We need to make a global array (or use a pre-defined one like your PlayerData (add it to the enum)) the size of MAX_PLAYERS. So, we put this outside of our functions...
new oldSkin[MAX_PLAYERS] = -1;
Right, so now that we have this global array defined..Let's make use of it. Inside of our command we'll put this


oldSkin[playerid] = GetPlayerSkin(playerid); //This will store their skin ID to the slot in the array equivalent to their ID.


So now that we have that, we can then set their skin to oldSkin when they go off duty.

SetPlayerSkin(playerid, oldSkin[playerid]); //gets the info stored in that array slot.


That's really ALL there is to it...Unless you want to save it to their file. That's a completely different matter of course.