28.01.2011, 19:43
I was wondering if anyone could redo this part so that an admin can send an individual player money instead of all players
Kinda like in XtremeAdmin where it has the givecash command. Hard to explain.
This code is used in XtremeAdmin. (What I need but in other FilterScript)
Kinda like in XtremeAdmin where it has the givecash command. Hard to explain.
Код:
dcmd_giveallcash(playerid,params[]) { if(AccInfo[playerid][Level] >= 3) { if(!strlen(params)) return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /giveallcash [Value]") && SendClientMessage(playerid, orange, "Function: Will give a specified value in Money for all players"); new var = strval(params), string[128]; SendCommandToAdmins(playerid,"GiveAllCash"); for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { PlayerPlaySound(i,1057,0.0,0.0,0.0); GivePlayerMoney(i,var); } } format(string,sizeof(string),"|- Administrator \"%s\" has given all Players '$%d' -|", pName(playerid), var ); return SendClientMessageToAll(blue, string); } else return ErrorMessages(playerid, 1); }
Код:
dcmd_givecash(playerid,params[]) { if(IsPlayerCommandLevel(playerid,"givecash")) { new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(!strlen(tmp)||!strlen(tmp2)||!IsNumeric(tmp2)||!(strval(tmp2) >= 1 && strval(tmp2) <= 1000000)) return SendClientMessage(playerid,red,"Syntax Error: \"/GIVECASH <NICK OR ID> <1 - 1,000,000>\"."); new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp); if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID) { SendCommandMessageToAdmins(playerid,"GIVECASH"); new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24); if(id != playerid) { format(string,256,"Administrator \"%s\" has given you $%d.",name,strval(tmp2)); SendClientMessage(id,yellow,string); format(string,256,"You have given \"%s\" $%d.",ActionName,strval(tmp2)); SendClientMessage(playerid,yellow,string); } else { format(string,256,"You have given yourself $%d.",strval(tmp2)); SendClientMessage(playerid,yellow,string); } return GivePlayerMoney(id,strval(tmp2)); } return SendClientMessage(playerid,red,"ERROR: You can not give a disconnected player cash."); } else return SendLevelErrorMessage(playerid,"givecash"); }