11.06.2018, 08:30
Your code makes no sense, hence it will result in sending an error message to the admin which tries to execute the command.
First issue:
You had a comma here which is not needed, Mike had fixed that but I don't know why he didn't change the rest of the code, or maybe he didn't see it.
Changed to:
Second Issue:
I assume that this is an admin command because its just spawning the amount of cash which the person inputted. So it must be an admin command, or otherwise regular players will be able to use it.
This piece of code makes no sense, why are you checking if the player rank is greater than 1 and then sending the admin the error message that he/she is not an admin. In other words if an level 5 admin uses the command it wont work because their level is higher than 1 so it would result in them receiving the error message.
Thirdly, I have taken the time out to review and remake your code which should work perfectly.
First issue:
You had a comma here which is not needed, Mike had fixed that but I don't know why he didn't change the rest of the code, or maybe he didn't see it.
PHP код:
if(sscanf(params, "ui", giveplayerid, suma)) [B],[/B] SCM(playerid, COLOR_SPRINGGREEN, "/givemonney <playerid> <suma>");
PHP код:
if(sscanf(params, "ui", giveplayerid, suma)) return SCM(playerid, COLOR_SPRINGGREEN, "/givemonney <playerid> <suma>");
I assume that this is an admin command because its just spawning the amount of cash which the person inputted. So it must be an admin command, or otherwise regular players will be able to use it.
This piece of code makes no sense, why are you checking if the player rank is greater than 1 and then sending the admin the error message that he/she is not an admin. In other words if an level 5 admin uses the command it wont work because their level is higher than 1 so it would result in them receiving the error message.
PHP код:
if(playerAdmin[playerid] > 1) return SendClientMessage(playerid, COLOR_YELLOWGREEN, "Nu esti admin!");
if(playerAdmin[playerid] < 5) return SendClientMessage(playerid, COLOR_YELLOWGREEN, "Doar adminii de nivel
PHP код:
CMD:givemoney(playerid, params[])
{
if(playerAdmin[playerid] >= 5)
{
new string[256], giveplayerid, suma, player2[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, player2, sizeof(player2));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(sscanf(params, "ui", giveplayerid, suma)) return SCM(playerid, COLOR_SPRINGGREEN, "/givemonney <playerid> <suma>");
if(giveplayerid == INVALID_PLAYER_ID) return SCM(playerid, COLOR_SPRINGGREEN, "Player-ul nu este conectat!");
GivePlayerMoney(giveplayerid, suma);
format(string, sizeof(string), "Ai primit $%d de la adminul %s",suma,sendername);
SCM(playerid, COLOR_MEDIUMMAGENTA, string);
format(string, sizeof(string), "I-ai dat player-ului %s[ID:%d] suma de $%d.", player2, giveplayerid, suma);
SCM(playerid, COLOR_MEDIUMMAGENTA, string);
}
else return SendClientMessage(playerid, COLOR_YELLOWGREEN, "Nu esti admin!");
return 1;
}