Can a scripter help me figure out the problem with this: -
Dokins - 29.11.2011
pawn Код:
CMD:demote(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new giveplayerid;
if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /demote [player id or name]");
if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
if(Faction[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a faction.");
else if(Faction[giveplayerid] != Faction[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "That player is not in your faction.");
new string[200], rank;
FRank[giveplayerid] --;
new factionid = Faction[playerid];
if(rank > FRank[giveplayerid]) switch(rank) {
case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
}
SendClientMessage(playerid, COLOUR_ORANGE, string);
new string1[200];
if(rank > FRank[giveplayerid]) switch(rank) {
case 1: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(2)", GetNameEx(playerid), FactionRank2[factionid]);
case 2: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(3)", GetNameEx(playerid), FactionRank3[factionid]);
case 3: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(4)", GetNameEx(playerid), FactionRank4[factionid]);
case 4: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(5)", GetNameEx(playerid), FactionRank5[factionid]);
case 5: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(6)", GetNameEx(playerid), FactionRank6[factionid]);
case 6: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(7)", GetNameEx(playerid), FactionRank7[factionid]);
}
SendClientMessage(giveplayerid, COLOUR_ORANGE, string1);
FRank[playerid] = rank;
MySQL_SetInteger(PlayerSQLID[playerid], "FRank", rank, "Accounts");
return 1;
}
Basically it wont SendClientMessage and set's the player's rank to 0.
Any help would be nice.
Re: Can a scripter help me figure out the problem with this: -
seanny - 29.11.2011
Try this one:
pawn Код:
CMD:demote(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new giveplayerid;
if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /demote [player id or name]");
if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
if(Faction[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a faction.");
else if(Faction[giveplayerid] != Faction[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "That player is not in your faction.");
new string[200], rank;
FRank[giveplayerid] --;
new factionid = Faction[playerid];
if(rank > FRank[giveplayerid]) switch(rank) {
case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
SendClientMessage(playerid, COLOUR_ORANGE, string);
}
new string1[200];
if(rank > FRank[giveplayerid]) switch(rank) {
case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
SendClientMessage(playerid, COLOUR_ORANGE, string);
}
FRank[playerid] = rank;
MySQL_SetInteger(PlayerSQLID[playerid], "FRank", rank, "Accounts");
return 1;
}
Re: Can a scripter help me figure out the problem with this: -
Kostas' - 29.11.2011
Not tested.
pawn Код:
CMD:demote(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new
giveplayerid;
else if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /demote [player id or name]");
else if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
else if(Faction[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a faction.");
else if(Faction[giveplayerid] != Faction[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "That player is not in your faction.");
else {
new
string[200],
string1[200],
rank;
FRank[giveplayerid] --;
new
factionid = Faction[playerid];
if(rank > FRank[giveplayerid]) switch(rank) {
case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
SendClientMessage(playerid, COLOUR_ORANGE, string);
case 1: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(2)", GetNameEx(playerid), FactionRank2[factionid]);
case 2: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(3)", GetNameEx(playerid), FactionRank3[factionid]);
case 3: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(4)", GetNameEx(playerid), FactionRank4[factionid]);
case 4: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(5)", GetNameEx(playerid), FactionRank5[factionid]);
case 5: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(6)", GetNameEx(playerid), FactionRank6[factionid]);
case 6: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(7)", GetNameEx(playerid), FactionRank7[factionid]);
SendClientMessage(giveplayerid, COLOUR_ORANGE, string1);
}
}
FRank[playerid] = rank;
MySQL_SetInteger(PlayerSQLID[playerid], "FRank", rank, "Accounts");
return 1;
}
Re: Can a scripter help me figure out the problem with this: -
Dokins - 29.11.2011
I'll give them a test! Thanks!
Re: Can a scripter help me figure out the problem with this: -
Dokins - 29.11.2011
Second one doesnt work, testing first.
Re: Can a scripter help me figure out the problem with this: -
Dokins - 29.11.2011
Second one doesn't work either.
Re: Can a scripter help me figure out the problem with this: -
Kostas' - 29.11.2011
Try this. I hope to work. I confused on the last cases.
pawn Код:
CMD:demote(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new
giveplayerid;
if(isnull(params)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /demote [player id or name]");
if(FRank[playerid] < 6) return SendClientMessage(playerid, COLOUR_GREY, "You are not a high enough rank.");
if(Faction[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not in a faction.");
if(Faction[giveplayerid] != Faction[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "That player is not in your faction.");
new
string[200],
string1[200],
rank;
FRank[giveplayerid] --;
new
factionid = Faction[playerid];
if(rank > FRank[giveplayerid]) {
switch(rank) {
case 1: format(string, sizeof(string), "You have demoted %s to the rank of %s(2)", GetNameEx(giveplayerid), FactionRank2[factionid]);
case 2: format(string, sizeof(string), "You have demoted %s to the rank of %s(3)", GetNameEx(giveplayerid), FactionRank3[factionid]);
case 3: format(string, sizeof(string), "You have demoted %s to the rank of %s(4)", GetNameEx(giveplayerid), FactionRank4[factionid]);
case 4: format(string, sizeof(string), "You have demoted %s to the rank of %s(5)", GetNameEx(giveplayerid), FactionRank5[factionid]);
case 5: format(string, sizeof(string), "You have demoted %s to the rank of %s(6)", GetNameEx(giveplayerid), FactionRank6[factionid]);
case 6: format(string, sizeof(string), "You have demoted %s to the rank of %s(7)", GetNameEx(giveplayerid), FactionRank7[factionid]);
SendClientMessage(playerid, COLOUR_ORANGE, string);
case 7: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(2)", GetNameEx(playerid), FactionRank2[factionid]);
case 8: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(3)", GetNameEx(playerid), FactionRank3[factionid]);
case 9: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(4)", GetNameEx(playerid), FactionRank4[factionid]);
case 10: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(5)", GetNameEx(playerid), FactionRank5[factionid]);
case 11: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(6)", GetNameEx(playerid), FactionRank6[factionid]);
case 12: format(string1, sizeof(string1), "%s has demoted you to the rank of %s(7)", GetNameEx(playerid), FactionRank7[factionid]);
SendClientMessage(giveplayerid, COLOUR_ORANGE, string1);
}
}
FRank[playerid] = rank;
MySQL_SetInteger(PlayerSQLID[playerid], "FRank", rank, "Accounts");
return 1;
}
Re: Can a scripter help me figure out the problem with this: -
MP2 - 29.11.2011
That command makes no sense. Why would setting their rank to 12 show it as being set to 7?
Re: Can a scripter help me figure out the problem with this: -
Dokins - 30.11.2011
I completely re-wrote the command and it works, Used If statements! Thanks!