Is this possible?
#1

Now we have player1 and player2 example:
player1 have enums:
PHP код:
pInfo[playerid][m4a1] - 10 // amount of m4a1
pInfo[playerid][ak47] - 15 // amount of ak47
rInfo[playerid][m4a1] - 2500 //price for m4a1
rInfo[playerid][ak47] - 3000 //price for ak47 
and now when player1 type /sellguns to freeze player, run animation DEALER and create dynamic checkpoint right in front of player1, and when player2 enter in that checkpoint to show it Dialog example:
PHP код:
title Dealer (Dealer name)
menu0 Buy M4A1 $(rInfo[playerid][m4a1]) Available(pInfo[playerid][m4a1])
menu1 Buy AK-47 $(rInfo[playerid][ak47]) Available(pInfo[playerid][ak47]) 
and when player2 buy any weapon to check player1 do you have from it and when have to check money on player2 if they have enough to give him weapon and take his money and give it to player1 and remove one of pInfo[playerid][m4a1] ?? and when player1 type again /sellguns to remove freeze, animation and dynamic checkpoint.
Now can you explain to me how this thing can be done, if at all possible. Thanks in advance
Reply
#2

Use :

ShowPlayerDialog
GivePlayerMoney with a negative amount
ClearAnimations
ApplyAnimation
OnPlayerEnterDynamicCP
CreateDynamicCP
IsPlayerInDynamicCP
DestroyDynamicCP
Reply
#3

sure,when he enters the command use:
pawn Код:
TogglePlayerControllable(playerid,0);
use loop and loop all of the players in it,and set marker for them,when player enters that marker,show him the dialog,and under the dialog,do whatev er you want ,and check the player2's money,if it's the right amount,give him -[price you want]
and rInfo[playerid][m4a1] -= 1;
Reply
#4

Yes, but i dont know how to make that Dynamic Checkpoint (unique) for every player ...
Reply
#5

add this under the command
pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i; i < MAX_PLAYERS; i++)
{
      if(IsPlayerConnected(i))
      {
             SetPlayerCheckPoint(i, x, y+1, z, 3.0); // make the checkpoint infront of the player
      }
}
Reply
#6

that's pretty easy

PHP код:

new uniquesCheckpoints[MAX_PLAYERS];
CMD:sellguns(playeridparams[])
{
      
// Your code here
      
uniquesCheckpoints[playerid] = CreateDynamicCP(parameters);
      return 
1;

Reply
#7

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
that's pretty easy

PHP код:

new uniquesCheckpoints[MAX_PLAYERS];
CMD:sellguns(playeridparams[])
{
      
// Your code here
      
uniquesCheckpoints[playerid] = CreateDynamicCP(parameters);
      return 
1;

Hm yes ok, but when player2-3-4-5... enter in that checkpoint which is created by player1 how to make unique Dialog for that player when someone buy weapon, example to give money to player1 and take from it m4a1 or ak47 ?
Reply
#8

I didn't really understand.

A dialog is unique by definition : when a player shows a dialog, you act on a "playerid" var, and playerid is the id of each player who shows the dialog.

So a code like that

PHP код:

new cp[MAX_PLAYERS];
CMD:sellguns(playeridparams[])
{
      
cp[playerid] = CreateDynamicCP(params);
      return 
1;
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
      foreach(new 
Player)
      {
            if(
cp[p] == checkpointid)
            {
                  
SetPVarInt(playerid"WeaponSeller"p);
                  return 
ShowPlayerDialog(playeridDIALOG_WEAPONSDIALOG_STYLE_LIST"Buying weapons""M4\nAk-47\n""Buy""Close");
            }
      }
      return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
      if(
dialogid == DIALOG_WEAPONS)
      {
            if(!
response) return 1;
            if(
listitem == 0)
            {
                  
GivePlayerWeapon(playerid31999);
                  
GivePlayerMoney(playerid, -price_of_the_m4);
                  
GivePlayerMoney(GetPVarInt(playerid"WeaponSeller"), price_of_the_m4);
                  return 
1;
            }
            else if(
listitem == 1)
            {
                  
GivePlayerWeapon(playerid30999);
                  
GivePlayerMoney(playerid, -price_ak_47);
                  
GivePlayerMoney(GetPVarInt(playerid"WeaponSeller"), price_ak_k7);
                  return 
1;
            }
      }
      return 
0;
}
public 
OnPlayerExitDynamicCP(playeridcheckpointid)
{
      foreach(new 
Players)
      {
            if(
checkpointid == cp[p]) DeletePVar(playerid"WeaponSeller");
      }

Will work as a charm.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)