CMD:admintitle(playerid, params[])
{
static
atitle[32],
userid;
if(PlayerData[playerid][pAdmin] < 6)
return SendErrorMessage(playerid, "You don't have permission to use this command.");
if (userid == INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "You have specified an invalid player.");
if(PlayerData[userid][pAdmin] < 1)
return SendErrorMessage(playerid, "This player is not an administrator.");
format(PlayerData[userid][pAdminTitle], 32, atitle);
return 1;
}
if(sscanf(params, "us[32]", userid, atitle))
{
//error
}
else
{
//atitle and userid are both set
}
CMD:admintitle(playerid, params[])
{
static
atitle[32],
userid;
if(PlayerData[playerid][pAdmin] < 6)
return SendErrorMessage(playerid, "You don't have permission to use this command.");
if (userid == INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "You have specified an invalid player.");
if(PlayerData[userid][pAdmin] < 1)
return SendErrorMessage(playerid, "This player is not an administrator.");
if(sscanf(params, "uss[32]", userid, atitle)) {
return SendSyntaxMessage(playerid, "/admintitle [ID/Name] [Title]");
}
else format(PlayerData[userid][pAdminTitle], 32, atitle);
return 1;
}
if (userid == INVALID_PLAYER_ID)
CMD:admintitle(playerid, params[])
{
static
atitle[32],
userid;
if(PlayerData[playerid][pAdmin] < 6)
return SendErrorMessage(playerid, "You don't have permission to use this command.");
if(sscanf(params, "uss[32]", userid, atitle)) {
return SendSyntaxMessage(playerid, "/admintitle [ID/Name] [Title]");
}
else format(PlayerData[userid][pAdminTitle], 32, atitle);
if (userid == INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "You have specified an invalid player.");
if(PlayerData[userid][pAdmin] < 1)
return SendErrorMessage(playerid, "This player is not an administrator.");
return 1;
}
if (userid == INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "You have specified an invalid player.");
if(PlayerData[userid][pAdmin] < 1)
return SendErrorMessage(playerid, "This player is not an administrator.");
"uss[32]" will be "ID", "string" and "string"[size of 32], yet you only added "userid" and "atitle", so you're not using the one in the middle, delete it. Also, you need to use a string size if you wanted to use the string in the middle. |
CMD:admintitle(playerid, params[])
{
static
atitle[32],
userid;
if(PlayerData[playerid][pAdmin] < 6)
return SendErrorMessage(playerid, "You don't have permission to use this command.");
if(sscanf(params, "us[32]", userid, atitle))
return SendSyntaxMessage(playerid, "/admintitle [ID/Name] [Title]");
if (userid == INVALID_PLAYER_ID)
return SendErrorMessage(playerid, "You have specified an invalid player.");
if(PlayerData[userid][pAdmin] < 1)
return SendErrorMessage(playerid, "This player is not an administrator.");
format(PlayerData[userid][pAdminTitle], 32, atitle);
return 1;
}
That wont work, these will be invalid:
pawn Код:
It should be like this: pawn Код:
|