pawn Код:
dcmd_showweapons(playerid,params[])
{
new string[128];
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /showweapons (Player Name/ID)");
return 1;
}
if(GetPVarInt(playerid, "Spawned") == 0)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(gTeam[playerid] != TEAM_GUNDEL)
{
SendClientMessage(playerid,COLOR_ERROR,"Only Weapon Dealers can show people their weapons for sale.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot give them weapons",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to show him weapons.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(gTeam[ID] == TEAM_GUNDEL)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot give other Weapon Dealers weapons .. Im sure they have plenty.");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot give yourself weapons. Go to Ammunation to get some.");
return 1;
}
if(GetPVarInt(playerid, "Spawned") == 0)
{
format(string,sizeof(string),"%s(%d) is not spawned. You cannot give dead people weapons ..",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(CalledForWeaponDealer[ID] == 0)
{
SendClientMessage(playerid,COLOR_ERROR,"They have not called for a weapon dealer. You cannot give them weapons.");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
{
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Weapon list shown_]]");
format(string,sizeof(string),"You have shown your list of weapons for sale to %s(%d). Use /sellweapon to sell them a weapon.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
format(string,sizeof(string),"%s(%d) has shown you their list of weapons for sale. Tell them which number you want to buy from them.",PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
ShowPlayerDialog(ID,DIALOG_WEAPONS,DIALOG_STYLE_MSGBOX,"{33CCFF}Weapon Dealer List","{FFFFFF}{10F441}1: {FFFFFF}M4 (500 Ammo - $5000)\n{10F441}2: {FFFFFF}Tec-9 (300 Ammo - $5000)\n{10F441}3: {FFFFFF}Sniper (40 Ammo - $5000)\n{10F441}4: {FFFFFF}Combat Shotgun (100 Ammo - $7000)\n{10F441}5: {FFFFFF}Deagle (40 Ammo - $5000)\n{10F441}6: {FFFFFF}Armour (100 - $6000)","Ok","Cancel");
return 1;
}
return 1;
}