Save/Get previous weapons.
#1

I wonder if i can make, Save/Get previous weapons. Whats the code
Reply
#2

search in ******
there's alot of script like that you want
Reply
#3

Try it http://pastebin.com/TaD5miwQ.
Reply
#4

Quote:
Originally Posted by IamPRO
Посмотреть сообщение
Well, that's a bad script.
Reply
#5

i mean, when player is admin off duty then he /aduty to get on duty, it will save his previous weapons then if he go admin off duty again the previous weapon will load. Is that possible?
Reply
#6

Quote:
Originally Posted by PawnOX
Посмотреть сообщение
i mean, when player is admin off duty then he /aduty to get on duty, it will save his previous weapons then if he go admin off duty again the previous weapon will load. Is that possible?
do you make codes for that?
Reply
#7

Quote:
Originally Posted by SturtIndia
Посмотреть сообщение
do you make codes for that?
Here
pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "This is an admin only command!");
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0)
        {

        SendClientMessageEx(playerid, COLOR_BLUE, "You are now on Administrator duty! !");
        //SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
        PlayerInfo[playerid][pAdminDuty] = 1;

        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        //SetPlayerColor(playerid, COLOR_TWORANGE);
        SetPlayerColor(playerid, COLOR_REALRED);
        GivePlayerWeapon(playerid, 24, 99999);
        GivePlayerWeapon(playerid, 43, 60000);
        GivePlayerWeapon(playerid, 24, 60000);
        GivePlayerWeapon(playerid, 31, 99999);
        GivePlayerWeapon(playerid, 32, 99999);
        GivePlayerWeapon(playerid, 27, 99999);
        GivePlayerWeapon(playerid, 34, 99999);
        if(PlayerInfo[playerid][pAdmin] >= 1) {
        GivePlayerWeapon(playerid, 38, 99999);
        }
        new szMessage[47 + (MAX_PLAYER_NAME * 2)];
        format(szMessage, sizeof(szMessage), "Administrator %s is now ON Duty!", GetPlayerNameEx(playerid));
        //ABroadCast(COLOR_YELLOW,szMessage, 2);

        SendClientMessageToAllEx(COLOR_REALRED, szMessage);
        }
        else
        {
        SendClientMessageEx(playerid, COLOR_BLUE, "You are now off admin duty!");
        //SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 0);
        RemovePlayerWeapon(playerid, 24);
        RemovePlayerWeapon(playerid, 43);
        RemovePlayerWeapon(playerid, 46);
        RemovePlayerWeapon(playerid, 24);
        RemovePlayerWeapon(playerid, 31);
        RemovePlayerWeapon(playerid, 32);
        RemovePlayerWeapon(playerid, 27);
        RemovePlayerWeapon(playerid, 34);
        SetPlayerToTeamColor(playerid);
        Delete3DTextLabel(DutyLabel[playerid]);
        //SetPlayerSkin(playerid, 299); - Commented by Voltage
        PlayerInfo[playerid][pAdminDuty] = 0;
        new szMessage[47 + (MAX_PLAYER_NAME * 2)];
        format(szMessage, sizeof(szMessage), "Administrator %s is now OFF Duty!", GetPlayerNameEx(playerid));
        //format(szMessage, sizeof(szMessage), "AdmCmd: Administrator %s is now Off Duty!", GetPlayerNameEx(playerid));
    //  ABroadCast(COLOR_YELLOW,szMessage, 2);
        SendClientMessageToAllEx(COLOR_REALRED, szMessage);
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by PawnOX
Посмотреть сообщение
i mean, when player is admin off duty then he /aduty to get on duty, it will save his previous weapons then if he go admin off duty again the previous weapon will load. Is that possible?
At first:
pawn Код:
new
    weap[MAX_PLAYERS][12 char],
    ammo[MAX_PLAYERS][12]
;

savePlayerGuns(p)
{
    for(new i=sizeof ammo[]; i != 0; i--)
    {
        GetPlayerWeaponData(p, i, weap[p][i],ammo[p][i]);
    }
    return true;
}

loadPlayerGuns(p)
{
    for(new i=sizeof ammo[]; i != 0; i--)
    {
        if !weap[playerid][i] *then continue;
        GivePlayerWeapon(playerid, weap[p][i],ammo[p][i]);
    }
}
/aduty on (before you give him admin weapons):
pawn Код:
savePlayerGuns(.p=playerid);
/aduty off (at the end og the command):
pawn Код:
loadPlayerGuns(.p=playerid);
Reply
#9

pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "This is an admin only command!");
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0)
        {

        SendClientMessageEx(playerid, COLOR_BLUE, "You are now on Administrator duty! !");
        //SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
        PlayerInfo[playerid][pAdminDuty] = 1;

        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        //SetPlayerColor(playerid, COLOR_TWORANGE);
        SetPlayerColor(playerid, COLOR_REALRED);
        ResetPlayerWeapons(killerid);
        GivePlayerWeapon(playerid, 24, 99999);
        GivePlayerWeapon(playerid, 43, 60000);
        GivePlayerWeapon(playerid, 24, 60000);
        GivePlayerWeapon(playerid, 31, 99999);
        GivePlayerWeapon(playerid, 32, 99999);
        GivePlayerWeapon(playerid, 27, 99999);
        GivePlayerWeapon(playerid, 34, 99999);
        if(PlayerInfo[playerid][pAdmin] >= 1) {
        GivePlayerWeapon(playerid, 38, 99999);
        }
        new szMessage[47 + (MAX_PLAYER_NAME * 2)];
        format(szMessage, sizeof(szMessage), "Administrator %s is now ON Duty!", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_YELLOW,szMessage, 2);

        SendClientMessageToAllEx(COLOR_REALRED, szMessage);
        }
        else
        {
        SendClientMessageEx(playerid, COLOR_BLUE, "You are now off admin duty!");
        SpawnPlayer(playerid);
        //SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 0);
        ResetPlayerWeapons(killerid);
        SetPlayerToTeamColor(playerid);
        Delete3DTextLabel(DutyLabel[playerid]);
        SetPlayerSkin(playerid, 299); - Commented by Voltage
        PlayerInfo[playerid][pAdminDuty] = 0;
        new szMessage[47 + (MAX_PLAYER_NAME * 2)];
        format(szMessage, sizeof(szMessage), "Administrator %s is now OFF Duty!", GetPlayerNameEx(playerid));
        format(szMessage, sizeof(szMessage), "AdmCmd: Administrator %s is now Off Duty!", GetPlayerNameEx(playerid));
        ABroadCast(COLOR_YELLOW,szMessage, 2);
        SendClientMessageToAllEx(COLOR_REALRED, szMessage);
        }
    }
    return 1;
}
It will spawn player again after offduty and I made some changes also
Reply
#10

Quote:
Originally Posted by JM_Millers
Посмотреть сообщение
At first:
pawn Код:
new
    weap[MAX_PLAYERS][12 char],
    ammo[MAX_PLAYERS][12]
;

savePlayerGuns(p)
{
    for(new i=sizeof ammo[]; i != 0; i--)
    {
        GetPlayerWeaponData(p, i, weap[p][i],ammo[p][i]);
    }
    return true;
}

loadPlayerGuns(p)
{
    for(new i=sizeof ammo[]; i != 0; i--)
    {
        if !weap[playerid][i] *then continue;
        GivePlayerWeapon(playerid, weap[p][i],ammo[p][i]);
    }
}
/aduty on (before you give him admin weapons):
pawn Код:
savePlayerGuns(.p=playerid);
/aduty off (at the end og the command):
pawn Код:
loadPlayerGuns(.p=playerid);
Код:
(93221) : warning 219: local variable "ammo" shadows a variable at a preceding level
 : warning 203: symbol is never used: "loadPlayerGuns"
 : warning 203: symbol is never used: "savePlayerGuns"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)