10.04.2018, 05:07
Quote:
it is possible to change this command to give score
CMD:givecash(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3) { new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givecash [playerid] [amount]"); new player1 = strval(tmp), cash = strval(tmp2), string[128]; if(PlayerInfo[player1][Level] == 8 && PlayerInfo[playerid][Level] != return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { CMDMessageToAdmins(playerid,"GIVECASH"); format(string, sizeof(string), "You have given '$%d to \"%s\", ", cash, pName(player1)); SendClientMessage(playerid,blue,string); if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has given you '%i'", pName(playerid), cash); SendClientMessage(player1,blue,string); } return GivePlayerMoneyEx(player1, cash); } else return SendClientMessage(playerid,red,"ERROR: Player is not connected"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } |
PHP код:
CMD:givescore(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 3)
{
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givescore [playerid] [amount]");
new player1 = strval(tmp), amount = strval(tmp2), string[128];
if(PlayerInfo[player1][Level] == 8 && PlayerInfo[playerid][Level] != return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
CMDMessageToAdmins(playerid,"GIVESCORE");
format(string, sizeof(string), "You have given '%i to \"%s\", ", amount, pName(player1));
SendClientMessage(playerid,blue,string);
if(player1 != playerid)
{
format(string,sizeof(string),"Administrator \"%s\" has given you '%i'", pName(playerid), amount);
SendClientMessage(player1,blue,string);
}
return GivePlayerScore(player1, amount);
}
else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
}
else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}