02.01.2014, 18:27
I am fairly new to scripting, so I heard that zcmd is pretty simple and better than strcmp, so I got zcmd and sscanf2 and I tried to make a simple money command, and it failed.
After I found that out, I made a simple one and IT failed too!
Also, where am I supposed to place the cmd? I just put it at the bottom of the script because I heard that you cant put it in one of the call backs...? Help would be appreciated. Thank you!
Код:
// Give Money - Finished - 10:09 02/01/2014
CMD:givemoney(playerid, params[])
{
new targetid, ammount, sendername[MAX_PLAYER_NAME], recievername[MAX_PLAYER_NAME], string[128];
if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid, COLOR_WHITE, "/givemoney [ID] [Ammount]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a staff member");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected");
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(targetid, recievername, sizeof(recievername));
format(string, sizeof(string), "You have recieved %s dollars from staff member %s", ammount, sendername);
SendClientMessage(targetid, COLOR_GREEN, string);
format(string, sizeof(string), "You have added %s dollars to %d 's account", ammount, targetid);
SendClientMessage(playerid, COLOR_GOLD, string);
GivePlayerMoney(targetid, ammount);
return 1;
}
Код:
CMD:test(playerid, params[]) if (!PlayerIsAdmin(playerid)) return SendClientMessage(playerid, 0xFFFF00AA, "No admin for you."); if PlayerIsAdmin(playerid) SendClientMessage(playerid, 0XFFFF00AA, "You're a admin mate!"); return 1;

