I made a weapondealer who can make a shop.
And if the player is in shop who want to buy gives money to the dealer but how can i do that?
Код:
if(armshop[playerid]==1)
{
if(IsPlayerConnected(GetPVarInt(playerid, "arm1")) && GetPVarType(playerid, "copTicket") != 0) {
GivePlayerMoney(GetPVarInt(playerid, "arm1"), SkillPrice[playerid]);
DeletePVar(playerid, "arm1");
}
GivePlayerWeapon(playerid,33,1000);
}
Its something with Setpvarint but at the command for shop i dont have another playerid(ID) only one playerid
Код:
dcmd_showweapons(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_RED,"USAGE: /showweapons (Player Name/ID)");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_RED,"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_RED,"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_RED,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_RED,string);
return 1;
}
/*if(gTeam[ID] == TEAM_GUNDEL)
{
SendClientMessage(playerid,COLOR_RED,"You cannot give other Weapon Dealers weapons .. Im sure they have plenty.");
return 1;
}*/
/*if(playerid == ID)
{
SendClientMessage(playerid,COLOR_RED,"You cannot give yourself weapons. Go to Ammunation to get some.");
return 1;
}*/
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s(%d) is not spawned. You cannot give dead people weapons ..",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
/*if(CalledForWeaponDealer[ID] == 0)
{
SendClientMessage(playerid,COLOR_RED,"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),"~n~~n~~n~~n~ ~n~~y~ 1 ~w~- Weapon1 $%d~n~~y~ 2 ~w~- Weapon2 $%d~n~~y~ 3 ~w~- Weapon3 $%d~n~~y~ 4 ~w~- Weapon4 $%d~n~~y~ 5 ~w~- Weapon5 $%d~n~~y~ 6 ~w~- Weapon6 $%d~n~~y~ 7 ~w~- Weapon7 $%d~n~~y~ 8 ~w~- Weapon8 $%d~n~~y~ 9 ~w~- Weapon9 $%d~n~~y~ 10 ~w~- Weapon10 $%d~n~",SkillPrice[playerid]);
TextDrawSetString(TextDraw4[playerid],string);
TextDrawShowForPlayer(ID,TextDraw4[playerid]);
SetPVarInt(ID, "arm1", playerid);
armshop[ID]=1;
return 1;
}
return 1;
}