SA-MP Forums Archive
dcmd_setdonator doesn't work correctly - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd_setdonator doesn't work correctly (/showthread.php?tid=143567)



dcmd_setdonator doesn't work correctly - Andy_McKinley - 23.04.2010

My command (DCMD) setdonator doesn't work correctly because when I type /setdonator (no player ID or donatorlvl) it says ''Administrator [UF]DarkPhoenix has set your donator level to 0''. But, I don't get the lvl 0 part because I didn't fill in a donator level or even player ID. It's supposed to be /setdonator [playername/id] [donator level (1-3)]

Here's my command (DCMD):
pawn Код:
dcmd_setdonator(playerid, params[])
{
  new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
    if(sscanf(params,"ud"),target,donatorlvl) SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
    if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
    if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");

    GetPlayerName(playerid, adminName, sizeof(adminName));
    format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
    SystemMsg(target, myString),
    GetPlayerName(target, targetName, sizeof(targetName));
    format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);
   
    pInfo[playerid][pDonator] = donatorlvl;
    dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
    return 1;
}



Re: dcmd_setdonator doesn't work correctly - dcmd_crash - 23.04.2010

pawn Код:
dcmd_setdonator(playerid, params[])
{
  new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
    if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
    if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");
    if(sscanf(params,"ud"),target,donatorlvl) return SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
    else
    {
      GetPlayerName(playerid, adminName, sizeof(adminName));
      format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
      SystemMsg(target, myString),
      GetPlayerName(target, targetName, sizeof(targetName));
      format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);
   
      pInfo[playerid][pDonator] = donatorlvl;
      dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
    }
    return 1;
}



Re: dcmd_setdonator doesn't work correctly - Andy_McKinley - 23.04.2010

Quote:
Originally Posted by _❼_
pawn Код:
dcmd_setdonator(playerid, params[])
{
  new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
    if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
    if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");
    if(sscanf(params,"ud"),target,donatorlvl) return SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
    else
    {
      GetPlayerName(playerid, adminName, sizeof(adminName));
      format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
      SystemMsg(target, myString),
      GetPlayerName(target, targetName, sizeof(targetName));
      format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);
   
      pInfo[playerid][pDonator] = donatorlvl;
      dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
    }
    return 1;
}
Same bug in-game (not working).


Re: dcmd_setdonator doesn't work correctly - SiJ - 23.04.2010

pawn Код:
dcmd_setdonator(playerid, params[])
{
  new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
    else if(sscanf(params,"ud"),target,donatorlvl) SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
    else if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
    else if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");
    else
    {
        GetPlayerName(playerid, adminName, sizeof(adminName));
        format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
        SystemMsg(target, myString),
        GetPlayerName(target, targetName, sizeof(targetName));
        format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);   
        pInfo[playerid][pDonator] = donatorlvl;
        dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
        return 1;
    }
}



Re: dcmd_setdonator doesn't work correctly - dcmd_crash - 23.04.2010

Ahh shit I see why now.

pawn Код:
dcmd_setdonator(playerid, params[])
{
  new donatorlvl, target, myString[128], adminName[MAX_PLAYER_NAME], targetName[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] < 5) return SystemMessage(playerid, "You are not an Administrator with the required level.");
    if(target == INVALID_PLAYER_ID) return SystemMessage(playerid, "That player is not active.");
    if(donatorlvl > 3 && donatorlvl < 0) return SystemMessage(playerid, "Please enter a valid donator level. (1-3)");
    if(sscanf(params,"ud",target,donatorlvl)) return SystemMessage(playerid, "USAGE: /setdonator [playername/playerid] [level (1-3)]");
    else
    {
      GetPlayerName(playerid, adminName, sizeof(adminName));
      format(myString, sizeof(myString), "Administrator %s has set your donator level to %i.",adminName, donatorlvl);
      SystemMsg(target, myString),
      GetPlayerName(target, targetName, sizeof(targetName));
      format(myString, sizeof(myString), "You have set %s's donator level to %i.",targetName, donatorlvl);
   
      pInfo[playerid][pDonator] = donatorlvl;
      dUserSetINT(targetName).("Donator",pInfo[playerid][pDonator]);
    }
    return 1;
}
Try this


Re: dcmd_setdonator doesn't work correctly - Andy_McKinley - 23.04.2010

I fixed it by myself anyway but thanks!

1 question: The message ''You have set %s's donator level to %i.'' isn't working... Help?


Re: dcmd_setdonator doesn't work correctly - dcmd_crash - 23.04.2010

You're not sending it anywhere, all you're doing is formatting the string :P