aduty problem
#1

my problem about this when im on duty then i give money to my self then go off duty it saves it didnt go back from the money i have before going on duty
Код:
CMD:aduty(playerid, params[])
{
	new str[126];
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
	if(AdminDuty[playerid] != 1)
	{
	    aCash[playerid] = PlayerInfo[playerid][pCash];
		SetPlayerHealth(playerid,99999);
		SetPlayerArmour(playerid,99999);
	    if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
		AdminDuty[playerid] = 1;
		format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
		SendClientMessageToAdmins(-1, str, 1);
		SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
		SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
		GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
	}
	else
	{
		TogglePlayerSpectating(playerid, false);
		SetCameraBehindPlayer(playerid);
	    AdminDuty[playerid] = 0;
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
		SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
		SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
		SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
	    SetPlayerName(playerid, PlayerInfo[playerid][pName]);
		new string[126];
		format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
		AdminLog(string);
		PlayerInfo[playerid][pCash] = aCash[playerid];
	    SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
	    format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
		SendClientMessageToAdmins(-1, str, 1);
		SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
		spec[playerid] = -1;
	}
	return 1;
}
Reply
#2

bumb ..T_T
Reply
#3

pawn Код:
CMD:aduty(playerid, params[])
{
    new str[126];
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
    if(AdminDuty[playerid] != 1)
    {
        PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); //This
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
        AdminDuty[playerid] = 1;
        format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
        SendClientMessageToAdmins(-1, str, 1);
        SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
        SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
        GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
    }
    else
    {
        TogglePlayerSpectating(playerid, false);
        SetCameraBehindPlayer(playerid);
        AdminDuty[playerid] = 0;
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        SetPlayerCash(playerid, PlayerInfo[playerid][pCash]); // and This
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
        SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
        SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
        SetPlayerName(playerid, PlayerInfo[playerid][pName]);
        new string[126];
        format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
        AdminLog(string);
        PlayerInfo[playerid][pCash] = aCash[playerid];
        SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
        format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
        SendClientMessageToAdmins(-1, str, 1);
        SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
        spec[playerid] = -1;
    }
    return 1;
}
Try this.!
Reply
#4

there is no SetPlayerCash function
Reply
#5

pawn Код:
CMD:aduty(playerid, params[])
{
    new str[126];
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
    if(AdminDuty[playerid] != 1)
    {
        PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); //This
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
        AdminDuty[playerid] = 1;
        format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
        SendClientMessageToAdmins(-1, str, 1);
        SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
        SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
        GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
    }
    else
    {
        TogglePlayerSpectating(playerid, false);
        SetCameraBehindPlayer(playerid);
        AdminDuty[playerid] = 0;
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); // and This
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
        SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
        SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
        SetPlayerName(playerid, PlayerInfo[playerid][pName]);
        new string[126];
        format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
        AdminLog(string);
        PlayerInfo[playerid][pCash] = aCash[playerid];
        SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
        format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
        SendClientMessageToAdmins(-1, str, 1);
        SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
        spec[playerid] = -1;
    }
    return 1;
}
Reply
#6

there is no such thing as getplayercash
Reply
#7

pawn Код:
#define GetPlayerCash(%0) PlayerInfo[%0][pCash]
pawn Код:
CMD:aduty(playerid, params[])
{
    new str[126];
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
    if(AdminDuty[playerid] != 1)
    {
        PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); //This
        SetPlayerHealth(playerid,99999);
        SetPlayerArmour(playerid,99999);
        if(isnull(PlayerInfo[playerid][pAName])) return SendClientMessage(playerid, -1, "You don't have an admin name.");
        AdminDuty[playerid] = 1;
        format(str, sizeof(str), "%s (ID %i - %s) is now on duty as a level %i admin.", PlayerInfo[playerid][pAName], playerid, GetName(playerid), PlayerInfo[playerid][pAdmin]);
        SendClientMessageToAdmins(-1, str, 1);
        SetPlayerName(playerid, PlayerInfo[playerid][pAName]);
        SendClientMessage(playerid, -1, "You are now on duty as an admin, you do now have access to all of your commands.");
        GetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
    }
    else
    {
        TogglePlayerSpectating(playerid, false);
        SetCameraBehindPlayer(playerid);
        AdminDuty[playerid] = 0;
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], 0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
        ResetSetPlayerCash(playerid); //This
        GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
        SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
        SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
        SetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
        SetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
        SetPlayerName(playerid, PlayerInfo[playerid][pName]);
        new string[126];
        format(string, 126, "%s Old cash: %i - New cash: %i", GetName(playerid), PlayerInfo[playerid][pCash], aCash);
        AdminLog(string);
        PlayerInfo[playerid][pCash] = aCash[playerid];
        SetPlayerPos(playerid, PlayerInfo[playerid][pAx], PlayerInfo[playerid][pAy], PlayerInfo[playerid][pAz]);
        format(str, sizeof(str), "%s (ID %i - %s) is now off admin duty.", PlayerInfo[playerid][pAName], playerid, GetName(playerid));
        SendClientMessageToAdmins(-1, str, 1);
        SendClientMessage(playerid, -1, "You are now off duty as an admin and have only a limited access to your commands.");
        spec[playerid] = -1;
    }
    return 1;
}
Okay try this one.
Reply
#8

it didnt work out try to see the whole code

http://pastebin.com/1R2CpEVs
Reply
#9

bumb
Reply
#10

bumb..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)