SA-MP Forums Archive
/setadminlevel /setviplevel - 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)
+--- Thread: /setadminlevel /setviplevel (/showthread.php?tid=440524)



/setadminlevel /setviplevel - Giroud12 - 30.05.2013

Im making /setadminlevel /setviplevel command using ZCMD but not works?
Do you guys what is the code if my enum is :

pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdminLevel,
    pVIPLevel,
    pScores,
    pIP[24],
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Really need help


Re: /setadminlevel /setviplevel - DaRk_RaiN - 30.05.2013

So you want the commands?
pawn Код:
CMD:setadminlevel (playerid, params[])
{
        if(PlayerInfo[ playerid ][ pAdminLevel ] < 9 && !IsPlayerAdmin( playerid ) ) return SendClientMessage(playerid, -1,"You must be a higher level admin to use this command");
        new level, aname[MAX_PLAYER_NAME];
        new targetid;
        if(sscanf(params, "ri", targetid, level)) return SendClientMessage(playerid, -1,"ERROR: /setadminlevel playerid level");
        if (level > 10 || level < 0) return SendClientMessage(playerid, -1,"ERROR: invalid level");
        if(!IsPlayerConnected( targetid )) return SendClientMessage(playerid, -1,"ERROR: player isn't connected");
        new string1[130], tname[MAX_PLAYER_NAME], string2[130];
        //if(!fexist(UserPath( targetid )))return SendClientMessage(playerid, -1,"ERROR: player isn't registered");
        /*
        new INI:File = INI_Open(UserPath( targetid ));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Level", level);
        INI_Close(File);
        */

        PlayerInfo[ targetid ][ pAdminLevel ] = level;
        GetPlayerName(playerid, aname, sizeof(aname));
        GetPlayerName(targetid, tname, sizeof(tname));
        format(string1, sizeof(string1), "Admin %s has set your Admin level to %i ", aname, level);
        SendClientMessage(targetid, Green, string1);
        format(string2, sizeof(string1), "Admin %s has set %s's level to %i", aname, tname, level);
        SendClientMessageToAll(Yellow, string2);
    return 1;
}



Re: /setadminlevel /setviplevel - Giroud12 - 30.05.2013

pawn Код:
//if(!fexist(UserPath( targetid )))return SendClientMessage(playerid, -1,"ERROR: player isn't registered");
        /*
        new INI:File = INI_Open(UserPath( targetid ));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Level", level);
        INI_Close(File);
        */
The green script in need to be use or not?


Re: /setadminlevel /setviplevel - DaRk_RaiN - 30.05.2013

Quote:
Originally Posted by Giroud12
Посмотреть сообщение
pawn Код:
//if(!fexist(UserPath( targetid )))return SendClientMessage(playerid, -1,"ERROR: player isn't registered");
        /*
        new INI:File = INI_Open(UserPath( targetid ));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Level", level);
        INI_Close(File);
        */
The green script in need to be use or not?
I did that on purpose because i don't know what's your saving method, but better keep it like that if the player stats gets saved when he disconnected.


Re: /setadminlevel /setviplevel - Giroud12 - 30.05.2013

Yup thx..1 question..how can i make ratio kill/death with my enum?


Re: /setadminlevel /setviplevel - Abhishek. - 30.05.2013

new Float:ratio[Max_Players]=PlayerInfo[playerid][pKills]/PlayerInfo[playerid][pDeaths];


Re: /setadminlevel /setviplevel - Giroud12 - 30.05.2013

and the message?


Re: /setadminlevel /setviplevel - Abhishek. - 30.05.2013

just print the variable ratio
where you want it to be.....td or client message


Re: /setadminlevel /setviplevel - Giroud12 - 30.05.2013

pawn Код:
CMD:stats(playerid,o[])
{
    new string[500] , pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    new Float:ratio[MAX_PLAYERS]=PlayerInfo[playerid][pKills]/PlayerInfo[playerid][pDeaths];
    format(string,sizeof(string),"-----------------STATS-----------------");
    SendClientMessage(playerid, YELLOW,string);
    format(string,sizeof(string),"* Stats Of %s *",pName);
    SendClientMessage(playerid, BLUE,string);
    format(string,sizeof(string),"Password: %s | Cash: %d | Deaths: %d | Kills: %d | Ratio: %d | Score: %d | Admin: %d |",pPass,pCash,pDeaths,pKills,ratio,pScores,pAdminLevel);
    SendClientMessage(playerid,BLUE,string);
    format(string,sizeof(string),"-----------------STATS-----------------");
    SendClientMessage(playerid,YELLOW,string);
    return 1;
}
Error:
Quote:

error 008: must be a constant expression; assumed zero




Re: /setadminlevel /setviplevel - DobbysGamertag - 30.05.2013

pawn Код:
CMD:setlevel(playerid,params[])
{
    new target,level,string[124],PlayerName[24];
    if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"USAGE:/setlevel [playerid] [level]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
    if(level < 0 || level > 3) return SendClientMessage(playerid,-1,"ERROR:Invalid level. (1,2,3)");
    GetPlayerName(target,PlayerName,sizeof(PlayerName));
    format(string,sizeof(string),"%s has been made a level %d admin!",PlayerName,level);
    SendClientMessageToAll(-1,string);
    pInfo[playerid][pAdminLevel] = level;
    return 1;
}
CMD:setviplevel(playerid,params[])
{
    new target,level,string[124],PlayerName[24];
    if(sscanf(params,"ud",target,level)) return SendClientMessage(playerid,-1,"USAGE:/seviplevel [playerid][level]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid,-1,"ERROR:Player not connected.");
    if(level < 0 || level > 1) return SendClientMessage(playerid,-1,"ERROR:Invalid level.(1 one only)");
    GetPlayerName(target,PlayerName,sizeof(PlayerName));
    format(string,sizeof(string),"%s has been made a level %d VIP",PlayerName,level);
    pInfo[playerid][pVIPLevel] = level;
    return 1;
}