Trying to fix the aduty command to load from mysql
#1

Hello, I'm trying to fix my Aduty command when you go onduty it loads the AdminName and when you go offduty it loads back your username but I keep struggling with errors

Код:
./includes/commands.pwn(39074) : warning 202: number of arguments does not match definition
./includes/commands.pwn(39074) : error 036: empty statement
./includes/commands.pwn(39100) : warning 202: number of arguments does not match definition
./includes/commands.pwn(39100) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
command:

PHP код:
CMD:aduty(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(
AdminDuty[playerid] == 0)
        {
            
39074            if(SetPlayerName(playerid) == 1);
            {
                new 
tmpName[24], query[128];
                
format(querysizeof(query), "SELECT `AdminName` FROM `accounts` WHERE `AdminName`='%s'"tmpName);
                
mysql_function_query(MainPipelinequeryfalse"OnQueryFinish""i"SENDDATA_THREAD);
            }
            
            new 
Float:healthFloat:armorstring[250];
            
SendClientMessage(playeridCOLOR_WHITE"You are now On-Duty..");
            
format(stringsizeof(string), "%s %s is now on admin duty ((/report for assistance ))"GetStaffRank(playerid), GetPlayerNameEx(playerid));
            
SendClientMessageToAllEx(COLOR_WHITEstring);
            
Log("logs/adminonduty.log"string);
            
PlayerInfo[playerid][pAdminDuty] = 1;
            
AdminDuty[playerid] = 1;
            
GetPlayerHealth(playerid,health);
            
SetPVarFloat(playerid"pPreGodHealth"health);
            
GetPlayerArmour(playerid,armor);
            
SetPVarFloat(playerid"pPreGodArmor"armor);
            
SetPlayerHealth(playerid0x7FB00000);
            
SetPlayerArmor(playerid0x7FB00000);
            
SetPVarInt(playerid"pGodMode"1);
        }
        else if(
AdminDuty[playerid] == 1)
        {
39100            if(SetPlayerName(playerid) == 1);
            {
                new 
tmpName[24], query[128];
                
format(querysizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username`='%s'"tmpName);
                
mysql_function_query(MainPipelinequeryfalse"OnQueryFinish""i"SENDDATA_THREAD);
            }
            
            new 
string[250];
            
SendClientMessage(playeridCOLOR_WHITE"You are now Off-Duty.");
            
SendClientMessage(playeridCOLOR_REALRED"Please remember to turn off any hacks you may have (press F12 to disable ******).");
            
format(stringsizeof(string), "%s %s is now off admin duty "GetStaffRank(playerid), GetPlayerNameEx(playerid));
            
ABroadCast(COLOR_WHITEstring1);
            
Log("logs/adminoffduty.log"string);
            
PlayerInfo[playerid][pAdminDuty] = 0;
            
AdminDuty[playerid] = 0;
            new 
Float:healthFloat:armor;
            
health GetPVarFloat(playerid"pPreGodHealth");
            
SetPlayerHealth(playerid,health);
            
armor GetPVarFloat(playerid"pPreGodArmor");
            
SetPlayerArmor(playeridarmor);
            
DeletePVar(playerid"pGodMode");
            
DeletePVar(playerid"pPreGodHealth");
            
DeletePVar(playerid"pPreGodArmor");
            
            if(
PlayerInfo[playerid][pAdmin] < 99999)
            {
                
ResetPlayerWeapons(playerid);
                
ResetPlayerCash(playerid);
                
                
DeletePVar(playerid"Packages");
                
PlayerInfo[playerid][pLiveBanned] = 0;
                
PlayerInfo[playerid][pPnumber] = 0;
                
PlayerInfo[playerid][pWarns] = 0;
                
PlayerInfo[playerid][pFMember] = 255;
                
PlayerInfo[playerid][pLeader] = 0;
                
PlayerInfo[playerid][pRank] = 0;
                
PlayerInfo[playerid][pJob] = 0;
                
PlayerInfo[playerid][pJob2] = 0;
                
//PlayerInfo[playerid][pDonateRank] = 0;
                
PlayerInfo[playerid][gPupgrade] = 0;
                
PlayerInfo[playerid][pCash] = 10000;
                
PlayerInfo[playerid][pAccount] = 0;
                
PlayerInfo[playerid][pInsurance] = 0;
                
PlayerInfo[playerid][pCrimes] = 0;
                
PlayerInfo[playerid][pArrested] = 0;
                
PlayerInfo[playerid][pWantedLevel] = 0;
                
PlayerInfo[playerid][pHealth] = 100;
                
PlayerInfo[playerid][pArmor] = 0;
                
PlayerInfo[playerid][pPot] = 0;
                
PlayerInfo[playerid][pCrack] = 0;
                
PlayerInfo[playerid][pCrates] = 0;
                
PlayerInfo[playerid][pRadio] = 0;
                
PlayerInfo[playerid][pRadioFreq] = 0;
                
PlayerInfo[playerid][pMats] = 0;
                
PlayerInfo[playerid][pRope] = 0;
                
PlayerInfo[playerid][pCigar] = 0;
                
PlayerInfo[playerid][pSprunk] = 0;
                
PlayerInfo[playerid][pSpraycan] = 0;
                
PlayerInfo[playerid][pPhousekey] = INVALID_HOUSE_ID;
                
PlayerInfo[playerid][pPhousekey2] = INVALID_HOUSE_ID;
                
PlayerInfo[playerid][pRenting] = INVALID_HOUSE_ID;
                
PlayerInfo[playerid][pInt] = 0;
                
PlayerInfo[playerid][pVW] = 0;
                
PlayerInfo[playerid][pJailTime] = 0;
                
PlayerInfo[playerid][pPayCheck] = 0;
                
PlayerInfo[playerid][pDetSkill] = 0;
                
PlayerInfo[playerid][pLawSkill] = 0;
                
PlayerInfo[playerid][pSexSkill] = 0;
                
PlayerInfo[playerid][pDrugsSkill] = 0;
                
PlayerInfo[playerid][pSmugSkill] = 0;
                
PlayerInfo[playerid][pArmsSkill] = 0;
                
PlayerInfo[playerid][pMechSkill] = 0;
                
PlayerInfo[playerid][pFishSkill] = 0;
                
PlayerInfo[playerid][pBoxSkill] = 0;
                
PlayerInfo[playerid][pTruckSkill] = 0;
                
PlayerInfo[playerid][pLawyerTime] = 0;
                
PlayerInfo[playerid][pLawyerFreeTime] = 0;
                
PlayerInfo[playerid][pDrugsTime] = 0;
                
PlayerInfo[playerid][pMechTime] = 0;
                
PlayerInfo[playerid][pSexTime] = 0;
                
PlayerInfo[playerid][pFishes] = 0;
                
PlayerInfo[playerid][pBiggestFish] = 0;
                
PlayerInfo[playerid][pScrewdriver] = 0;
                
PlayerInfo[playerid][pSmslog] = 0;
                
PlayerInfo[playerid][pWristwatch] = 0;
                
PlayerInfo[playerid][pTire] = 0;
                
PlayerInfo[playerid][pFirstaid] = 0;
                
PlayerInfo[playerid][pRccam] = 0;
                
PlayerInfo[playerid][pReceiver] = 0;
                
PlayerInfo[playerid][pGPS] = 0;
                
PlayerInfo[playerid][pSweep] = 0;
                
PlayerInfo[playerid][pSweepLeft] = 0;
                
PlayerInfo[playerid][pVehicleKeys] = INVALID_PLAYER_VEHICLE_ID// non-saved
                
PlayerInfo[playerid][pVehicleKeysFrom] = INVALID_PLAYER_ID// non-saved
                
PlayerInfo[playerid][pCarLic] = 1;
                
PlayerInfo[playerid][pFlyLic] = 1;
                
PlayerInfo[playerid][pBoatLic] = 1;
                
PlayerInfo[playerid][pFishLic] = 1;
                
PlayerInfo[playerid][pGunLic] = 1;
                
PlayerInfo[playerid][pDivision] = 0;
                
PlayerInfo[playerid][pTicketTime] = 0;
                
PlayerInfo[playerid][pHeadValue] = 0;
                
strcpy(PlayerInfo[playerid][pContractBy], "Nobody"64);
                
strcpy(PlayerInfo[playerid][pContractDetail], "None"64);
                
PlayerInfo[playerid][pC4] = 0;
                
PlayerInfo[playerid][pC4Used] = 0;
                
PlayerInfo[playerid][pBombs] = 0;
                
PlayerInfo[playerid][pCHits] = 0;
                
PlayerInfo[playerid][pFHits] = 0;
                
strcpy(PlayerInfo[playerid][pPrisonedBy], "Nobody"64);
                
strcpy(PlayerInfo[playerid][pPrisonReason], "None"64);
                
PlayerInfo[playerid][pAcceptReport] = 0;
                
PlayerInfo[playerid][pTrashReport] = 0;
                
PlayerInfo[playerid][pAccent] = 0;
                
PlayerInfo[playerid][pNMute] = 0;
                
PlayerInfo[playerid][pNMuteTotal] = 0;
                
PlayerInfo[playerid][pADMute] = 0;
                
PlayerInfo[playerid][pADMuteTotal] = 0;
                
PlayerInfo[playerid][pRMuted] = 0;
                
PlayerInfo[playerid][pRMutedTotal] = 0;
                
PlayerInfo[playerid][pRMutedTime] = 0;
                
PlayerInfo[playerid][pGCMuted] = 0;
                
PlayerInfo[playerid][pGCMutedTime] = 0;
                
PlayerInfo[playerid][pCallsAccepted] = 0;
                
PlayerInfo[playerid][pPatientsDelivered] = 0;
                
PlayerInfo[playerid][pTriageTime] = 0;
            
            }
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"You are not authorized to use that command.");
    }
    return 
1;

Reply
#2

PHP код:
if(SetPlayerName(playerid) == 1); 
this is a local function which sets the player name, you can't use this to detect variables or smths.
your whole code is messed up.
Reply
#3

Quote:
Originally Posted by Mugala
Посмотреть сообщение
PHP код:
if(SetPlayerName(playerid) == 1); 
this is a local function which sets the player name, you can't use this to detect variables or smths.
your whole code is messed up.
then how can I fix it so it will load AdminName once onduty and when go offduty your username ?
Reply
#4

you're just reloading the player's data again when they type /aduty (I mean second phase from - else if(AdminDuty[playerid] == 1))
you must get only adminname and username, than set it with SetPlayerName(playerid,name)

and remove if(SetPlayerName(playerid) == 1); from your code.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)