/makeadmin problem
#1

I make this.
PHP код:
CMD:makeadmin(playeridparams[])
{
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You have no acces to this command.");
   new 
PID;
   new 
player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
   new 
string[128]
   if(
sscanf(params"u"PID,pAdmin)) return SendClientMessage(playerid0xFFFF00"/makeadmin [playerid] [adminlevel]");
   
GetPlayerName(PIDgiveplayersizeof(giveplayer));
   
GetPlayerName(playeridplayersizeof(player));
   
PlayerInfo[PID][pAdmin] = level;
   
format(stringsizeof(string), "You are now an administrator level %d thanks to %s."level,  player);
   
SendClientMessage(giveplayerid0xFFFF00string);
   
format(stringsizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]);
   
SendClientMessage(playerid0xFFFF00string);
   if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid0xFF0000FF"This player isn't online."
   
return 1;

Have this.
PHP код:
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths

When compile get warning 203: symbol is never used: "makeadmin"
Reply
#2

you put somewhere in your script "new makeadmin"

find that line and delete it
Reply
#3

PHP код:
#include <a_samp>
#include <YSI\y_ini>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 
1;
}
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;
}
main()
{
        print(
"\n----------------------------------");
        print(
" In regia lui GoguXx ");
        print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
        
SetGameModeText("RPG v69");
        
AddStaticVehicle(522,1226.5582,-1867.9752,13.5469,1.1376006,000);
        return 
1;
}
public 
OnGameModeExit()
{
        return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
        return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Close(File);
    new
        
szString[64],
        
playerName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayerNameMAX_PLAYER_NAME);
    new 
szDisconnectReason[3][] =
    {
        
"Timeout/Crash",
        
"Quit",
        
"Kick/Ban"
    
};
    
format(szStringsizeof szString"%s left the server (%s)."playerNameszDisconnectReason[reason]);
    
SendClientMessageToAll(0xC4C4C4FFszString);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
        return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerInfo[killerid][pKills]++;
    
PlayerInfo[playerid][pDeaths]++;
    
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
    
SpawnPlayer(playerid);
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
        return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
        return 
1;
}
public 
OnPlayerText(playeridtext[])
{
        return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
        if (
strcmp("/mycommand"cmdtexttrue10) == 0)
        {
                
// Do something here
                
return 1;
        }
        return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
        return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
        return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
        return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
        return 
1;
}
public 
OnRconCommand(cmd[])
{
        return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
        return 
1;
}
public 
OnObjectMoved(objectid)
{
        return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
        return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
        return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
        return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
        return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
        return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
        return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
        return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
        return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
        return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
        return 
1;
}
public 
OnPlayerUpdate(playerid)
{
        return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
        return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
        return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
        return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
        return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
                
SpawnPlayer(playerid);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                        }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                    
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
                    
SpawnPlayer(playerid);
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerAdmin(playerid))
    {
        
SetPlayerPosFindZ(playeridfXfYfZ);
    }
    return 
1;
}
CMD:makeadmin(playeridparams[])
{
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You have no acces to this command.");
   new 
PID;
   new 
player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
   new 
string[128]
   if(
sscanf(params"u"PID,pAdmin)) return SendClientMessage(playerid0xFFFF00"/makeadmin [playerid] [adminlevel]");
   
GetPlayerName(PIDgiveplayersizeof(giveplayer));
   
GetPlayerName(playeridplayersizeof(player));
   
PlayerInfo[PID][pAdmin] = level;
   
format(stringsizeof(string), "You are now an administrator level %d thanks to %s."level,  player);
   
SendClientMessage(giveplayerid0xFFFF00string);
   
format(stringsizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]);
   
SendClientMessage(playerid0xFFFF00string);
   if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid0xFF0000FF"This player isn't online."
   
return 1;

I still don't find it.
Reply
#4

Quote:
Originally Posted by GabiXx
Посмотреть сообщение
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 
1;
}
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;
}
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;
}
main()
{
        print(
"\n----------------------------------");
        print(
" In regia lui GoguXx ");
        print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
        
SetGameModeText("RPG v69");
        
AddStaticVehicle(522,1226.5582,-1867.9752,13.5469,1.1376006,000);
        return 
1;
}
public 
OnGameModeExit()
{
        return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
        return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Close(File);
    new
        
szString[64],
        
playerName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayerNameMAX_PLAYER_NAME);
    new 
szDisconnectReason[3][] =
    {
        
"Timeout/Crash",
        
"Quit",
        
"Kick/Ban"
    
};
    
format(szStringsizeof szString"%s left the server (%s)."playerNameszDisconnectReason[reason]);
    
SendClientMessageToAll(0xC4C4C4FFszString);
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
        return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
PlayerInfo[killerid][pKills]++;
    
PlayerInfo[playerid][pDeaths]++;
    
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
    
SpawnPlayer(playerid);
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
        return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
        return 
1;
}
public 
OnPlayerText(playeridtext[])
{
        return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
        if (
strcmp("/mycommand"cmdtexttrue10) == 0)
        {
                
// Do something here
                
return 1;
        }
        return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
        return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
        return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
        return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
        return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
        return 
1;
}
public 
OnRconCommand(cmd[])
{
        return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
        return 
1;
}
public 
OnObjectMoved(objectid)
{
        return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
        return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
        return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
        return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
        return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
        return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
        return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
        return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
        return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
        return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
        return 
1;
}
public 
OnPlayerUpdate(playerid)
{
        return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
        return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
        return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
        return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
        return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
                
SpawnPlayer(playerid);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                        }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                    
SetSpawnInfo(playerid001214.8846,-1821.6281,13.5943,179.1360000000);
                    
SpawnPlayer(playerid);
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
    if(
IsPlayerAdmin(playerid))
    {
        
SetPlayerPosFindZ(playeridfXfYfZ);
    }
    return 
1;
}
CMD:makeadmin(playeridparams[])
{
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You have no acces to this command.");
   new 
PID;
   new 
player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
   new 
string[128]
   if(
sscanf(params"u"PID,pAdmin)) return SendClientMessage(playerid0xFFFF00"/makeadmin [playerid] [adminlevel]");
   
GetPlayerName(PIDgiveplayersizeof(giveplayer));
   
GetPlayerName(playeridplayersizeof(player));
   
PlayerInfo[PID][pAdmin] = level;
   
format(stringsizeof(string), "You are now an administrator level %d thanks to %s."level,  player);
   
SendClientMessage(giveplayerid0xFFFF00string);
   
format(stringsizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]);
   
SendClientMessage(playerid0xFFFF00string);
   if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid0xFF0000FF"This player isn't online."
   
return 1;

I still don't find it.
lol , include <ZCMD> :P

P.S: https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#5

Код:
CMD:makeadmin(playerid, params[]) 
{ 
   if(PlayerInfo[PID][pAdmin] >= 5 || IsPlayerAdmin(playerid))
  {
   new PID; 
   new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME]; 
   new string[128] 
   if(sscanf(params, "u", PID,pAdmin)) return SendClientMessage(playerid, 0xFFFF00, "/makeadmin [playerid] [adminlevel]"); 
   GetPlayerName(PID, giveplayer, sizeof(giveplayer)); 
   GetPlayerName(playerid, player, sizeof(player)); 
   PlayerInfo[PID][pAdmin] = level; 
   format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level,  player); 
   SendClientMessage(giveplayerid, 0xFFFF00, string); 
   format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]); 
   SendClientMessage(playerid, 0xFFFF00, string); 
   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000FF, "This player isn't online." 
   return 1; 
}
Reply
#6

Quote:
Originally Posted by whatreally
Посмотреть сообщение
Код:
CMD:makeadmin(playerid, params[]) 
{ 
   if(PlayerInfo[PID][pAdmin] >= 5 || IsPlayerAdmin(playerid))
  {
   new PID; 
   new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME]; 
   new string[128] 
   if(sscanf(params, "u", PID,pAdmin)) return SendClientMessage(playerid, 0xFFFF00, "/makeadmin [playerid] [adminlevel]"); 
   GetPlayerName(PID, giveplayer, sizeof(giveplayer)); 
   GetPlayerName(playerid, player, sizeof(player)); 
   PlayerInfo[PID][pAdmin] = level; 
   format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level,  player); 
   SendClientMessage(giveplayerid, 0xFFFF00, string); 
   format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]); 
   SendClientMessage(playerid, 0xFFFF00, string); 
   if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000FF, "This player isn't online." 
   return 1; 
}
Dude , you missed a bracket + he dosen't included ZCMD ...
Reply
#7

Код:
#include <a_samp>
#include <YSI\y_ini>
#include <ZCMD>
#include <sscanf>

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4

#define PATH "/Users/%s.ini"

#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}

main()
{
        print("\n----------------------------------");
        print(" In regia lui GoguXx ");
        print("----------------------------------\n");
}

public OnGameModeInit()
{
        SetGameModeText("RPG v69");
        AddStaticVehicle(522,1226.5582,-1867.9752,13.5469,1.1376, 006,000);
        return 1;
}

public OnGameModeExit()
{
        return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
        return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    new
        szString[64],
        playerName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);

    new szDisconnectReason[3][] =
    {
        "Timeout/Crash",
        "Quit",
        "Kick/Ban"
    };

    format(szString, sizeof szString, "%s left the server (%s).", playerName, szDisconnectReason[reason]);

    SendClientMessageToAll(0xC4C4C4FF, szString);
    return 1;
}

public OnPlayerSpawn(playerid)
{
        return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    SetSpawnInfo(playerid, 0, 0, 1214.8846,-1821.6281,13.5943,179.1360, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
        return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
        return 1;
}

public OnPlayerText(playerid, text[])
{
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/mycommand", cmdtext, true, 10) == 0)
        {
                // Do something here
                return 1;
        }
        return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
        return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
        return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
        return 1;
}

public OnRconCommand(cmd[])
{
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
        return 1;
}

public OnObjectMoved(objectid)
{
        return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
        return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
        return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
        return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
        return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
        return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
        return 1;
}

public OnPlayerExitedMenu(playerid)
{
        return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
        return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
        return 1;
}

public OnPlayerUpdate(playerid)
{
        return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
        return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
        return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
        return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
        return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1214.8846,-1821.6281,13.5943,179.1360, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                        }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Distractie placuta! Have fun!","Ok","");
                    SetSpawnInfo(playerid, 0, 0, 1214.8846,-1821.6281,13.5943,179.1360, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerPosFindZ(playerid, fX, fY, fZ);
    }
    return 1;
}

CMD:makeadmin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 5 || !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: {FFFFFF} You need to be admin level 5 or higher !");
	
   	new id, level;
   	new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
   	new String[128];

   	if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, 0xFFFF00, "USAGE: /makeadmin [PlayerID/PartOfName][AdminLevel]");
   	if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFF00, "ERROR: {FFFFFF}That player it's not connected !");

	GetPlayerName(id, pName, sizeof(pName));
   	GetPlayerName(playerid, aName, sizeof(aName));

	PlayerInfo[id][pAdmin] = level;
	
   	format(String, sizeof(String), "You are now an administrator level %d thanks to %s.", level, aName);
   	SendClientMessage(id, 0xFFFF00, String);

	format(String, sizeof(String), "You have given %s level %d admin.",  pName, level);
   	SendClientMessage(playerid, 0xFFFF00, String);
   	
   	return 1;
}
There it's the code fixed ...
Reply
#8

Yea, you right.
PHP код:
CMD:makeadmin(playeridparams[])
{
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You have no acces to this command.");
   new 
PID;
   new 
level;
   new 
player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
   new 
string[128]
   if(
sscanf(params"us[64]"PID,pAdmin)) return SendClientMessage(playerid0xFFFF00"/makeadmin [playerid] [adminlevel]");
   
GetPlayerName(PIDgiveplayersizeof(giveplayer));
   
GetPlayerName(playeridplayersizeof(player));
   
PlayerInfo[PID][pAdmin] = level;
   
format(stringsizeof(string), "You are now an administrator level %d thanks to %s."level,  player);
   
SendClientMessage(PID0xFFFF00string);
   
format(stringsizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]);
   
SendClientMessage(playerid0xFFFF00string);
   if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid0xFF0000FF"This player isn't online.");
   return 
1;

Now i get this at line with if(sscanf....."
error 001: expected token: ";", but found "if"
Reply
#9

Quote:
Originally Posted by GabiXx
Посмотреть сообщение
Yea, you right.
PHP код:
CMD:makeadmin(playeridparams[])
{
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xFF0000FF"You have no acces to this command.");
   new 
PID;
   new 
level;
   new 
player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
   new 
string[128]
   if(
sscanf(params"us[64]"PID,pAdmin)) return SendClientMessage(playerid0xFFFF00"/makeadmin [playerid] [adminlevel]");
   
GetPlayerName(PIDgiveplayersizeof(giveplayer));
   
GetPlayerName(playeridplayersizeof(player));
   
PlayerInfo[PID][pAdmin] = level;
   
format(stringsizeof(string), "You are now an administrator level %d thanks to %s."level,  player);
   
SendClientMessage(PID0xFFFF00string);
   
format(stringsizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[PID][pAdmin]);
   
SendClientMessage(playerid0xFFFF00string);
   if(!
IsPlayerConnected(PID)) return SendClientMessage(playerid0xFF0000FF"This player isn't online.");
   return 
1;

Now i get this at line with if(sscanf....."
error 001: expected token: ";", but found "if"
Код:
new string[128]
there you missed ';'

Код HTML:
new string[128];
Check above , i put fixed CMD ..
Reply
#10

When i try use /makeadmin 1,2,3,4, the message show player get admin level 0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)