SA-MP Forums Archive
Help With pickpocket - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With pickpocket (/showthread.php?tid=225356)



Help With pickpocket - Sepelin - 13.02.2011

How can i make this work?

PHP код:
if(strcmp(cmd"/pickpocket"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /pickpocket [Playerid/PartOfName]");
                return 
1;
            }
            if(
IsPlayerInAnyVehicle(playerid))
            {
                
SendClientMessage(playeridCOLOR_GREY"   Cannot use this while in a Car !");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
               if(
IsPlayerConnected(giveplayerid))
            {
                if(
ProxDetectorS(5.0playeridgiveplayerid))
                {
                    if(
pCD[playerid] == 1)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   You have to wait 30 seconds to pickpocket again !");
                           return 
1;
                    }
                    else
                    {
                           new 
name[MAX_PLAYER_NAME];
                        new 
name2[MAX_PLAYER_NAME];
                        
GetPlayerName(giveplayeridname2sizeof(name2));
                        
GetPlayerName(playeridnamesizeof(name));
                        
ApplyAnimation(playerid"DEALER""DEALER_DEAL"4.000000); // Deal
                        
format(stringsizeof(string), "%s Attempt to pickpocket %s"namename2);
                        
SendClientMessage(playeridCOLOR_PURPLEstring);
                        
SetTimer("Pickpocketed",2000,true);
                        return 
1;
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"   That player is not near you !");
                       return 
1;
                }
            }
        }
        return 
1;
    } 
PHP код:
public Pickpocketed(playerid)
{
    
ShowPlayerDialog(playerid680DIALOG_STYLE_LIST"PickPocket""Cash\nCrack\nPot\nMaterials""Select""Cancel");
    return 
1;

PHP код:
if(dialogid == 680// Pickpocket
    
{
        new 
string[128];
        new 
tmp[128];
        new 
giveplayerid;
        new 
name[MAX_PLAYER_NAME];
        new 
name2[MAX_PLAYER_NAME];
        
GetPlayerName(giveplayeridname2sizeof(name2));
        
GetPlayerName(playeridnamesizeof(name));
        
giveplayerid ReturnUser(tmp);
        if(
response)
        {
            if(
listitem == 0// Cash
            
{
                if(
PlayerInfo[playerid][pPocketL] == 1)
                {
                    if(
PlayerInfo[giveplayerid][pCash] < 199)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    if(
Pickpocket[giveplayerid] == 1)
                    {
                        new 
cash 200 random(900);
                        
PlayerInfo[giveplayerid][pCash] = PlayerInfo[playerid][pCash]-cash;
                        
GivePlayerMoney(giveplayerid, - cash);
                        
PlayerInfo[playerid][pCash] = PlayerInfo[giveplayerid][pCash]+cash;
                        
GivePlayerMoney(playeridcash);
                        
PlayerInfo[playerid][pPocketX] -= 1;
                        
format(stringsizeof(string),"* You robbed $%d From %s!",cash,name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
format(stringsizeof(string),"* %s robbed $%d From you!",namecash);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
pCD[playerid] = 1;
                        
SetTimer("Unsetpickpocket",30000,true);
                    }
                }
                else if(
PlayerInfo[playerid][pPocketL] == 2)
                {
                    if(
PlayerInfo[giveplayerid][pCash] < 999)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    if(
Pickpocket[giveplayerid] == 1)
                    {
                        new 
cash 1000 random(1900);
                        
PlayerInfo[giveplayerid][pCash] = PlayerInfo[playerid][pCash]-cash;
                        
GivePlayerMoney(giveplayerid, - cash);
                        
PlayerInfo[playerid][pCash] = PlayerInfo[giveplayerid][pCash]+cash;
                        
GivePlayerMoney(playeridcash);
                        
PlayerInfo[playerid][pPocketX] -= 1;
                        
format(stringsizeof(string),"* You robbed $%d From %s!",cash,name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
format(stringsizeof(string),"* %s robbed $%d From you!",namecash);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
pCD[playerid] = 1;
                        
SetTimer("Unsetpickpocket",30000,true);
                    }
                }
                else if(
PlayerInfo[playerid][pPocketL] == 3)
                {
                    if(
PlayerInfo[giveplayerid][pCash] < 1999)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    if(
Pickpocket[giveplayerid] == 1)
                    {
                        new 
cash 2000 random(2900);
                        
PlayerInfo[giveplayerid][pCash] = PlayerInfo[playerid][pCash]-cash;
                        
GivePlayerMoney(giveplayerid, - cash);
                        
PlayerInfo[playerid][pCash] = PlayerInfo[giveplayerid][pCash]+cash;
                        
GivePlayerMoney(playeridcash);
                        
format(stringsizeof(string),"* You robbed $%d From %s!",cash,name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
format(stringsizeof(string),"* %s robbed $%d From you!",namecash);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        
pCD[playerid] = 1;
                        
SetTimer("Unsetpickpocket",30000,true);
                    }
                }
            }
            if(
listitem == 1// Crack
            
{
                if(
PlayerInfo[playerid][pPocketL] == 1)
                {
                    if(
PlayerInfo[giveplayerid][pCrack] < 1)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    new 
crack random(10);
                    
PlayerInfo[giveplayerid][pCrack] = PlayerInfo[playerid][pCrack]-crack;
                    
PlayerInfo[playerid][pCrack] = PlayerInfo[giveplayerid][pCrack]+crack;
                    
PlayerInfo[playerid][pPocketX] -= 1;
                    
format(stringsizeof(string),"* You robbed %d gram crack From %s!",crack,name2);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
format(stringsizeof(string),"* %s robbed %d gram From you!",namecrack);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
pCD[playerid] = 1;
                    
SetTimer("Unsetpickpocket",30000,true);
                }
                else if(
PlayerInfo[playerid][pPocketL] == 2)
                {
                    if(
PlayerInfo[giveplayerid][pCrack] < 9)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    new 
crack 10 random(20);
                    
PlayerInfo[giveplayerid][pCrack] = PlayerInfo[playerid][pCrack]-crack;
                    
PlayerInfo[playerid][pCrack] = PlayerInfo[giveplayerid][pCrack]+crack;
                    
PlayerInfo[playerid][pPocketX] -= 1;
                    
PlayerInfo[playerid][pPocketX] -= 1;
                    
format(stringsizeof(string),"* You robbed %d gram crack From %s!",crack,name2);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
format(stringsizeof(string),"* %s robbed %d gram From you!",namecrack);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
pCD[playerid] = 1;
                    
SetTimer("Unsetpickpocket",30000,true);
                }
                else if(
PlayerInfo[playerid][pPocketL] == 3)
                {
                    if(
PlayerInfo[giveplayerid][pCrack] < 19)
                    {
                        
format(stringsizeof(string),"* There is nohing you can rob from %s",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
ProxDetectorS(5.0playeridgiveplayerid))
                    {
                        
format(stringsizeof(string),"* %s Moved from their spot!",name2);
                        
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                        return 
1;
                    }
                    if(!
IsPlayerConnected(Pickpocket[playerid]))
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   That player is Offline");
                        return 
1;
                    }
                    new 
crack 20 random(30);
                    
PlayerInfo[giveplayerid][pCrack] = PlayerInfo[playerid][pCrack]-crack;
                    
PlayerInfo[playerid][pCrack] = PlayerInfo[giveplayerid][pCrack]+crack;
                    
PlayerInfo[playerid][pPocketX] -= 1;
                    
format(stringsizeof(string),"* You robbed %d gram crack From %s!",crack,name2);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
format(stringsizeof(string),"* %s robbed %d gram From you!",namecrack);
                    
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                    
pCD[playerid] = 1;
                    
SetTimer("Unsetpickpocket",30000,true);
                }
            }
            if(
listitem == 2// Pot
            
{
               }
            if(
listitem == 3// Materials
            
{
            }
        }
    } 



Re: Help With pickpocket - Sepelin - 15.02.2011

Can someone please help me fix this??


Re: Help With pickpocket - UDV Production - 15.02.2011

well what is the problem?


Re: Help With pickpocket - Sepelin - 15.02.2011

The list loads but qwhen you are going to choose something from the list nothing happens :/


Re: Help With pickpocket - UDV Production - 15.02.2011

your dialog id must be matching with another dialog id which is why it doesn't shows up


Re: Help With pickpocket - Sepelin - 15.02.2011

There is only one dialog with that id


Re: Help With pickpocket - UDV Production - 15.02.2011

if so then write in case. For Example Like This

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
       
        if(dialogid == 1 && response)
        {
            switch(listitem)
            {
                case 0:
                {
                                //Your Code HERE
                        }
                        case 1:
                        {
                                //Your Code HERE
                        }
                        case 2:
                        {
                                //Your Code HERE
                        }
                       
             
                }
        }       return 1;
}



Re: Help With pickpocket - Steven82 - 15.02.2011

I wish people would stop posting in fucking [php] tags