Errors with this command -
Rydur - 02.01.2014
I got these errors when trying to run this command, could somebody make the command so it compiles correctly?
(33364) : error 003: declaration of a local variable must appear in a compound block
(33364) : warning 217: loose indentation
(33364) : error 017: undefined symbol "string"
(33364) : warning 215: expression has no effect
(33364) : error 001: expected token: ";", but found "]"
(33364) : fatal error 107: too many error messages on one line
Код HTML:
CMD:makegroupleader(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 4)
new string[512], iTargetID, iGroupID;
if(sscanf(params, "ud", iTargetID, iGroupID))
return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/makegroupleader [playerid] [groupid(/listgroups)]");
if(iGroupID > MAX_GROUPS && iGroupID != 255 || iGroupID < 0) {
format(string, sizeof(string),"Invalid group, ranges from 0 to %i & 255 - Remove.", MAX_GROUPS);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(IsPlayerConnected(iTargetID)) {
if(PlayerData[iTargetID][pGangID] != 255)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified player is in a gang.");
if(iGroupID == 255) {
if(pTazer{iTargetID} == 1) {
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0)
GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
}
format(string, sizeof(string), "Your leadership has been taken by Administrator %s.", getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have taken %s leadership.", getPlayerName(iTargetID));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s has taken %s leadership.", getPlayerName(playerid), getPlayerName(iTargetID));
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pRank] = 255;
PlayerData[iTargetID][pDivision] = 255;
PlayerData[iTargetID][pLeader] = 255;
PlayerData[iTargetID][pFaction] = 255;
HitmanBadge[iTargetID] = 255;
return 1;
}
if(GroupData[iGroupID][g_szGroupName][0] == 0)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified group has not been setup.");
if(GroupData[iGroupID][g_iDisabled] == 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You cannot make anyone the leader of this group, it's disabled.");
new iRankCount = 0;
for(new i = 0; i < MAX_GROUP_RANKS; i++) {
if(strlen(GroupRanks[iGroupID][i]) >= 1 && strcmp(GroupRanks[iGroupID][i], "None", true)) {
++iRankCount;
}
}
PlayerData[iTargetID][pLeader] = iGroupID;
PlayerData[iTargetID][pRank] = iRankCount-1;
PlayerData[iTargetID][pFaction] = iGroupID;
PlayerData[iTargetID][pDivision] = 0;
format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.", GroupData[iGroupID][g_szGroupName], getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have made %s the leader of the %s.", getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s had made %s the leader of %s (%i).", getPlayerName(playerid), getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName], iGroupID);
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pDuty] = 0;
SetPlayerToTeamColor(iTargetID);
}
}
else Invalid_Admin(playerid);
return 1;
}
Re: Errors with this command -
WhiteNigger - 02.01.2014
What kind of string ?33364
Re: Errors with this command -
Konstantinos - 02.01.2014
Use the code inside a block of code { } for more than 1 statement.
pawn Код:
CMD:makegroupleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
new iTargetID, iGroupID;
if(sscanf(params, "ud", iTargetID, iGroupID)) return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/makegroupleader [playerid] [groupid(/listgroups)]");
new string[128];
if(iGroupID > MAX_GROUPS && iGroupID != 255 || iGroupID < 0)
{
format(string, sizeof(string),"Invalid group, ranges from 0 to %i & 255 - Remove.", MAX_GROUPS);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(IsPlayerConnected(iTargetID))
{
if(PlayerData[iTargetID][pGangID] != 255) return SendClientMessage(playerid, COLOR_GRAD1, "The specified player is in a gang.");
if(iGroupID == 255)
{
if(pTazer{iTargetID} == 1)
{
// ...
}
format(string, sizeof(string), "Your leadership has been taken by Administrator %s.", getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have taken %s leadership.", getPlayerName(iTargetID));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s has taken %s leadership.", getPlayerName(playerid), getPlayerName(iTargetID));
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pRank] = 255;
PlayerData[iTargetID][pDivision] = 255;
PlayerData[iTargetID][pLeader] = 255;
PlayerData[iTargetID][pFaction] = 255;
HitmanBadge[iTargetID] = 255;
return 1;
}
if(GroupData[iGroupID][g_szGroupName][0] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "The specified group has not been setup.");
if(GroupData[iGroupID][g_iDisabled] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You cannot make anyone the leader of this group, it's disabled.");
new iRankCount = 0;
for(new i = 0; i < MAX_GROUP_RANKS; i++)
{
if(strlen(GroupRanks[iGroupID][i]) >= 1 && strcmp(GroupRanks[iGroupID][i], "None", true))
{
++iRankCount;
}
}
PlayerData[iTargetID][pLeader] = iGroupID;
PlayerData[iTargetID][pRank] = iRankCount-1;
PlayerData[iTargetID][pFaction] = iGroupID;
PlayerData[iTargetID][pDivision] = 0;
format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.", GroupData[iGroupID][g_szGroupName], getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have made %s the leader of the %s.", getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s had made %s the leader of %s (%i).", getPlayerName(playerid), getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName], iGroupID);
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pDuty] = 0;
SetPlayerToTeamColor(iTargetID);
}
}
else Invalid_Admin(playerid);
return 1;
}
On the part I commented: // ...
I don't know whether you want if pTazerReplace{iTargetID} > 0 then GivePlayerValidWeapon only:
pawn Код:
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0) GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
Or if pTazerReplace{iTargetID} > 0 then GivePlayerValidWeapon and reset the values:
pawn Код:
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0)
{
GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
}
Change accordingly.
Re: Errors with this command -
Rydur - 02.01.2014
Getting same errors.
Re: Errors with this command -
camaro8 - 02.01.2014
PHP код:
CMD:makegroupleader(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 4){
new string[512], iTargetID, iGroupID;
if(sscanf(params, "ud", iTargetID, iGroupID))
return SendClientMessage(playerid, COLOR_GRAD1, SYNTAX_MESSAGE"/makegroupleader [playerid] [groupid(/listgroups)]");
if(iGroupID > MAX_GROUPS && iGroupID != 255 || iGroupID < 0) {
format(string, sizeof(string),"Invalid group, ranges from 0 to %i & 255 - Remove.", MAX_GROUPS);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(IsPlayerConnected(iTargetID)) {
if(PlayerData[iTargetID][pGangID] != 255)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified player is in a gang.");
if(iGroupID == 255) {
if(pTazer{iTargetID} == 1) {
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0)
GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
}
format(string, sizeof(string), "Your leadership has been taken by Administrator %s.", getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have taken %s leadership.", getPlayerName(iTargetID));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s has taken %s leadership.", getPlayerName(playerid), getPlayerName(iTargetID));
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pRank] = 255;
PlayerData[iTargetID][pDivision] = 255;
PlayerData[iTargetID][pLeader] = 255;
PlayerData[iTargetID][pFaction] = 255;
HitmanBadge[iTargetID] = 255;
return 1;
}
if(GroupData[iGroupID][g_szGroupName][0] == 0)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified group has not been setup.");
if(GroupData[iGroupID][g_iDisabled] == 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You cannot make anyone the leader of this group, it's disabled.");
new iRankCount = 0;
for(new i = 0; i < MAX_GROUP_RANKS; i++) {
if(strlen(GroupRanks[iGroupID][i]) >= 1 && strcmp(GroupRanks[iGroupID][i], "None", true)) {
++iRankCount;
}
}
PlayerData[iTargetID][pLeader] = iGroupID;
PlayerData[iTargetID][pRank] = iRankCount-1;
PlayerData[iTargetID][pFaction] = iGroupID;
PlayerData[iTargetID][pDivision] = 0;
format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.", GroupData[iGroupID][g_szGroupName], getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have made %s the leader of the %s.", getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s had made %s the leader of %s (%i).", getPlayerName(playerid), getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName], iGroupID);
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pDuty] = 0;
SetPlayerToTeamColor(iTargetID);
}
}
else Invalid_Admin(playerid);
return 1;
}
Re: Errors with this command -
Rydur - 02.01.2014
(33366) : error 017: undefined symbol "SYNTAX_MESSAGE"
(33366) : warning 217: loose indentation
(33366) : warning 215: expression has no effect
(33366) : error 001: expected token: ";", but found ")"
(33366) : error 029: invalid expression, assumed zero
(33366) : fatal error 107: too many error messages on one line
Re: Errors with this command -
camaro8 - 02.01.2014
PHP код:
CMD:makegroupleader(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 4){
new string[512], iTargetID, iGroupID;
if(sscanf(params, "ud", iTargetID, iGroupID))
return SendClientMessage(playerid, COLOR_GRAD1,"/makegroupleader [playerid] [groupid(/listgroups)]");
if(iGroupID > MAX_GROUPS && iGroupID != 255 || iGroupID < 0) {
format(string, sizeof(string),"Invalid group, ranges from 0 to %i & 255 - Remove.", MAX_GROUPS);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
if(IsPlayerConnected(iTargetID)) {
if(PlayerData[iTargetID][pGangID] != 255)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified player is in a gang.");
if(iGroupID == 255) {
if(pTazer{iTargetID} == 1) {
RemovePlayerWeapon(iTargetID, 23);
if(pTazerReplace{iTargetID} > 0)
GivePlayerValidWeapon(iTargetID, pTazerReplace{iTargetID}, 60000);
pTazer{iTargetID} = 0;
pTazerReplace{iTargetID} = 0;
}
format(string, sizeof(string), "Your leadership has been taken by Administrator %s.", getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have taken %s leadership.", getPlayerName(iTargetID));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s has taken %s leadership.", getPlayerName(playerid), getPlayerName(iTargetID));
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pRank] = 255;
PlayerData[iTargetID][pDivision] = 255;
PlayerData[iTargetID][pLeader] = 255;
PlayerData[iTargetID][pFaction] = 255;
HitmanBadge[iTargetID] = 255;
return 1;
}
if(GroupData[iGroupID][g_szGroupName][0] == 0)
return SendClientMessage(playerid, COLOR_GRAD1, "The specified group has not been setup.");
if(GroupData[iGroupID][g_iDisabled] == 1)
return SendClientMessage(playerid, COLOR_GRAD1, "You cannot make anyone the leader of this group, it's disabled.");
new iRankCount = 0;
for(new i = 0; i < MAX_GROUP_RANKS; i++) {
if(strlen(GroupRanks[iGroupID][i]) >= 1 && strcmp(GroupRanks[iGroupID][i], "None", true)) {
++iRankCount;
}
}
PlayerData[iTargetID][pLeader] = iGroupID;
PlayerData[iTargetID][pRank] = iRankCount-1;
PlayerData[iTargetID][pFaction] = iGroupID;
PlayerData[iTargetID][pDivision] = 0;
format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.", GroupData[iGroupID][g_szGroupName], getPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have made %s the leader of the %s.", getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s had made %s the leader of %s (%i).", getPlayerName(playerid), getPlayerName(iTargetID), GroupData[iGroupID][g_szGroupName], iGroupID);
Log("logs/makeleader.log", string);
PlayerData[iTargetID][pDuty] = 0;
SetPlayerToTeamColor(iTargetID);
}
}
else Invalid_Admin(playerid);
return 1;
}
Re: Errors with this command -
Rydur - 02.01.2014
I basically need a makeleader command that works dynamically and with MySQL.
Re: Errors with this command -
HB - 02.01.2014
What you should do is trying to learn how to script, instead of asking others to fix the errors for you... Or hire a scripter who is capable of performing the tasks for you.
Re: Errors with this command -
Rydur - 02.01.2014
I'm trying that and i progressed a little into it more, i can't get me to actually be put INTO the faction but there are no errors left.