Error Command /makeadmin
#1

C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 001: expected token: ";", but found ")"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 029: invalid expression, assumed zero
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : fatal error 107: too many error messages on one line
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51244) : error 017: undefined symbol "PlayerName"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 012: invalid function call, not a valid address

Script Code
Код:
CMD:makeadmin(playerid,params[])
{
	new pID, value;
	if(!IsPlayerAdmin(playerid)) return 0;
	else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, -1, "Usage: /setadmin (id) (level)");
	else if(value < 0 || value > 3) return SendClientMessage(playerid, -1, "Only levels 0-3");
	else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player Is Not Currently Connected");
	else
	{
		new string[128];
		format(string, sizeof(string), "You have set %s Admin level to %i", PlayerName(pID), value);
		SendClientMessage(playerid, -1, string);
		format(string, sizeof(string), "Your Admin level has been set to %i by %s", value, pName(playerid));
		SendClientMessage(pID, -1, string);
		PlayerInfo[pID][pAdmin] = value;
	}
	return 1;
}
[Line Error 51244]
Код:
format(string, sizeof(string), "You have set %s Admin level to %i", PlayerName(pID), value);
[Line Error 51246]
format(string, sizeof(string), "Your Admin level has been set to %i by %s", value, pName(playerid));
Reply
#2

Quote:
Originally Posted by Tihoy232
Посмотреть сообщение
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 001: expected token: ";", but found ")"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 029: invalid expression, assumed zero
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : fatal error 107: too many error messages on one line
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51244) : error 017: undefined symbol "PlayerName"
C:\Users\User.User-PC\Downloads\JakartaGamers-Roleplay-v1.6.0\JakartaGamers Roleplay\Aman\gamemodes\a.pwn(51246) : error 012: invalid function call, not a valid address

Script Code
Код:
CMD:makeadmin(playerid,params[])
{
	new pID, value;
	if(!IsPlayerAdmin(playerid)) return 0;
	else if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, -1, "Usage: /setadmin (id) (level)");
	else if(value < 0 || value > 3) return SendClientMessage(playerid, -1, "Only levels 0-3");
	else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player Is Not Currently Connected");
	else
	{
		new string[128];
		format(string, sizeof(string), "You have set %s Admin level to %i", PlayerName(pID), value);
		SendClientMessage(playerid, -1, string);
		format(string, sizeof(string), "Your Admin level has been set to %i by %s", value, pName(playerid));
		SendClientMessage(pID, -1, string);
		PlayerInfo[pID][pAdmin] = value;
	}
	return 1;
}
[Line Error 51244]
Код:
format(string, sizeof(string), "You have set %s Admin level to %i", PlayerName(pID), value);
[Line Error 51246]
format(string, sizeof(string), "Your Admin level has been set to %i by %s", value, pName(playerid));
PHP код:
CMD:makeadmin(playerid,params[])
{
    new 
pIDvalue;
    if(!
IsPlayerAdmin(playerid)) return 0;
    if(
sscanf(params"dd"pIDvalue)) return SendClientMessage(playerid, -1"Usage: /setadmin (id) (level)");
    if(
value || value 3) return SendClientMessage(playerid, -1"Only levels 0-3");
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1"Player Is Not Currently Connected");
    new 
string[128], name[25], pname[25];
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(pIDpnamesizeof(pname));
    
format(stringsizeof(string), "You have set %s Admin level to %d"pnamevalue);
    
SendClientMessage(playerid, -1string);
    
format(stringsizeof(string), "Your Admin level has been set to %d by %s"valuename);
    
SendClientMessage(pID, -1string);
    
PlayerInfo[pID][pAdmin] = value;
    return 
1;

try this

PHP код:
CMD:makeadmin(playerid,params[])
{
    new 
pIDvalue;
    if(!
IsPlayerAdmin(playerid)) return 0;
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playerid, -1"Usage: /setadmin (id) (level)");
    else if(
value || value 3) return SendClientMessage(playerid, -1"Only levels 0-3");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Player Is Not Currently Connected");
    else
    {
        new 
string[128];
        
format(stringsizeof(string), "You have set %s Admin level to %i"pName(pID), value);
        
SendClientMessage(playerid, -1string);
        
format(stringsizeof(string), "Your Admin level has been set to %i by %s"valuepName(playerid));
        
SendClientMessage(pID, -1string);
        
PlayerInfo[pID][pAdmin] = value;
    }
    return 
1;

or this
Reply
#3

pawn Код:
stock PlayerName(playerid)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    return playername;
}

CMD:makeadmin(playerid,params[])
{
    new pID, value;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ud", pID, value)) return SendClientMessage(playerid, -1, "Usage: /setadmin (id) (level)");
        else if(value < 0 || value > 3) return SendClientMessage(playerid, -1, "Only levels 0-3");
        else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player Is Not Currently Connected");
        else
        {
            new string[128];
            format(string, sizeof(string), "You have set %s Admin level to %d", PlayerName(pID), value);
            SendClientMessage(playerid, -1, string);
            format(string, sizeof(string), "Your Admin level has been set to %d by %s", value, pName(playerid));
            SendClientMessage(pID, -1, string);
            PlayerInfo[pID][pAdmin] = value;
        }
    }
    return 1;
}
i hope its work.

error 017: undefined symbol "PlayerName"
Reply
#4

You can't make a stock for the player name and its usuless, instead making stock place the define on player connection callback, then edit from PlayerName(pID) to PlayerName[pID].
Reply
#5

Quote:
Originally Posted by kecoajepit
Посмотреть сообщение
pawn Код:
stock PlayerName(playerid)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    return playername;
}

CMD:makeadmin(playerid,params[])
{
    new pID, value;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ud", pID, value)) return SendClientMessage(playerid, -1, "Usage: /setadmin (id) (level)");
        else if(value < 0 || value > 3) return SendClientMessage(playerid, -1, "Only levels 0-3");
        else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player Is Not Currently Connected");
        else
        {
            new string[128];
            format(string, sizeof(string), "You have set %s Admin level to %d", PlayerName(pID), value);
            SendClientMessage(playerid, -1, string);
            format(string, sizeof(string), "Your Admin level has been set to %d by %s", value, pName(playerid));
            SendClientMessage(pID, -1, string);
            PlayerInfo[pID][pAdmin] = value;
        }
    }
    return 1;
}
i hope its work.

error 017: undefined symbol "PlayerName"
he having pName(playerid) stock already he can use it again by pName(pID)
so dont need to make one more player name stock
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)