new tname[MAX_PLAYER_NAME]; // Who has been offered
new pname[MAX_PLAYER_NAME]; // Who offer
GetPlayerName(playerid,pname,sizeof(pname)); //Name of who offer weps
GetPlayerName(Target,tname,sizeof(tname)); // Name of who has been offered
pawn Код:
|
CMD:sellgun(playerid,params[])
{
new pstring[128], tstring[128], Target, pname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
if(sscanf(params, "u",Target)) return SendClientMessage(playerid, COLOR_RED,"Usage: /sellgun (id)");
else if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED,"That player isn't connected.");
else {
GetPlayerName(playerid ,pname, MAX_PLAYER_NAME);
GetPlayerName(playerid ,tname, MAX_PLAYER_NAME);
format(pstring,sizeof(pstring),"%s has offered you to buy some weapons. Use /buygun if you want to buy.", pname);
SendClientMessageToAll(COLOR_GREEN, pstring);
format(tstring,sizeof(tstring),"You offered %s to buy your weapons. Wait if he accepts.", tname);
SendClientMessageToAll(COLOR_GREEN, tstring);
buygun[Target] = 1;
SetTimerEx("buygunt", BUY_GUN, false, "i", playerid);
}
return 1;
}
CMD:buygun(playerid,params[])
{
if(buygun[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN,"You are looking through %s's his weapon list.");
ShowPlayerDialog(playerid, DIALOG_WEAPONS1, DIALOG_STYLE_LIST, "Weapons List", "Combat Shotgun{FF0000} [4000$] \n{FFFFFF}MP5{FF0000} [3000$]\n{FFFFFF}AK47{FF0000} [4000$]\n{FFFFFF}Shotgun{FF0000}[2000$]\n{FFFFFF}Armour {FF0000}[1000$]", "Buy", "Cancel");
}
return 1;
}
new pname[MAX_PLAYER_NAME]; // Who offer
GetPlayerName(playerid,pname,sizeof(pname));