30.07.2017, 10:43
Hello,i have this error,firstly i though from that level,between 1 and 6,i have 7 ranks,i changed but this error keep erroring)))))).
Code:
CMD:giverank(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pLeader] >= 1)
{
new para1,level,string[100],giveplayer[30],sendername[30],string2[100];
if(sscanf(params, "ui", para1,level)) return SendClientMessage(playerid, 0xFFFFFFFF,"{B8DBFF}Syntax: /giverank <Name/Playerid> <Rank(1-6)>");
if(level > 6 || level < 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Dont go below number 1 or above number 6.");
if(PlayerInfo[para1][pMember] != PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This member is not in your faction.");
if(PlayerInfo[para1][pLeader] > 0) return SCM(playerid,COLOR_WHITE,"{FFB870}This player is a leader.");
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pRank] = level;
format(string, sizeof(string), "* Leader %s promoted you to rank %d.", sendername,level);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You have given %s Rank %d.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
new str[128];
format(str,sizeof(str),"UPDATE users SET `Rank`='%d' WHERE `name`='%s'",PlayerInfo[para1][pRank],giveplayer);
mysql_query(SQL,str);
format(string2,sizeof(string2),"Got rank %d.",level);
Factionlog(PlayerInfo[para1][pMember],PlayerInfo[para1][pSQLID],string2);
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Only leaders can use this command.");
}
return 1;
}
Please help my little skill on scripting.
Code:
CMD:giverank(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pLeader] >= 1)
{
new para1,level,string[100],giveplayer[30],sendername[30],string2[100];
if(sscanf(params, "ui", para1,level)) return SendClientMessage(playerid, 0xFFFFFFFF,"{B8DBFF}Syntax: /giverank <Name/Playerid> <Rank(1-6)>");
if(level > 6 || level < 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Dont go below number 1 or above number 6.");
if(PlayerInfo[para1][pMember] != PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This member is not in your faction.");
if(PlayerInfo[para1][pLeader] > 0) return SCM(playerid,COLOR_WHITE,"{FFB870}This player is a leader.");
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pRank] = level;
format(string, sizeof(string), "* Leader %s promoted you to rank %d.", sendername,level);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You have given %s Rank %d.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
new str[128];
format(str,sizeof(str),"UPDATE users SET `Rank`='%d' WHERE `name`='%s'",PlayerInfo[para1][pRank],giveplayer);
mysql_query(SQL,str);
format(string2,sizeof(string2),"Got rank %d.",level);
Factionlog(PlayerInfo[para1][pMember],PlayerInfo[para1][pSQLID],string2);
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Only leaders can use this command.");
}
return 1;
}
Please help my little skill on scripting.