Help with a little command
#1

Good night everyone, I have been working on this code for some time, I thought it was finally ready, but now nothing happens when I try to sell a weapon to another player.
Thank you very much if anyone can help me!

PHP код:
     CMD:sellgun(playeridparams[])  
    {  
        new 
GetPlayerOrg(playerid), sstring[128], weaponidvaluematsw;  
          
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));  
          
GetPlayerName(playeridsendernamesizeof(sendername));  
          
weaponid;  
          
mats GetWeaponValue(w);  
        if(
PlayerInfo[playerid][pJob] == || OrgMafia(f))  
        {  
            if(
sscanf(params"us[45]d"giveplayeridweaponidvalue))  
            {  
                new 
0;  
                
23FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
24FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*45)/100))); SCM(playerid, -1sstring);  
                
25FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
27FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
29FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
30FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*45)/100))); SCM(playerid, -1sstring);  
                
31FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
33FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
34FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
39FORMAT_SSTR "[%d] %s - minimum value: R$%d (R$%d Client VIP/DIAMANTE)",g,WeaponsName[g],GetWeaponValue(g)+350,350+(GetWeaponValue(g)-((GetWeaponValue(g)*35)/100))); SCM(playerid, -1sstring);  
                
SCM(playerid, -1"Use: /sellgun [playerid] [number] [value]'");  
                return 
1;  
            }  
            if(
playerid == targetid) return SCM(playerid, -1"Use '/armaments' in the organization safe.");  
            else if(
w!=23&&w!=24&&w!=25&&w!=27&&w!=29&&w!=30&&w!=31&&w!=33&&w!=34&&w!=39) return SCM(playerid, -1"You do not have this weapon to sell..");  
            if(
weaponid == 23) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 24) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*45)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 25) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 27) { if(PlayerInfo[playerid][pGunSkill] >= 0300) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 03 of arms dealer."); }  
            else if(
weaponid == 29) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 30) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*45)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 31) { if(PlayerInfo[playerid][pGunSkill] >= 0300) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 03 of arms dealer."); }  
            else if(
weaponid == 33) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else if(
weaponid == 34) { if(PlayerInfo[playerid][pGunSkill] >= 1000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 05 of arms dealer."); }  
            else if(
weaponid == 39) { if(PlayerInfo[playerid][pGunSkill] >= 0000) { if(IsPlayerVIP(giveplayerid)) { mats -= ((mats*35)/100); } } else return SCM(playerid, -1"You are not level 01 of arms dealer."); }  
            else return 
1;  
            
////////////////////////////////////////////////////////////////////  
            
if(value < (mats+350) || value 20000) { FORMAT_SSTR "Minimum price for the sale of this weapon is R$%d.", (mats+350)); return SCM(playerid, -1sstring); }  
            if(
PlayerInfo[playerid][psMats] < mats) { FORMAT_SSTR "You need to get %d materials in the HQ."); return SCM(playerid, -1sstring); }  
            if(
PlayerInfo[playerid][pMats] < mats) { FORMAT_SSTR "You need to buy %d materials with some mafia."); return SCM(playerid, -1sstring); }  
            if(!
IsPlayerConnected(giveplayerid)) return SCM(playerid, -1"Player is not connect.");  
            if(
PlayerInfo[giveplayerid][pLevel] < 3) return SCM(playerid, -1"Player still can not receive weapons.");  
            if(
weaponid == 34) return SCM(playerid, -1"ERROR: A sniper has already been mounted, wait a few minutes until another is ready.");  
            if(
weaponid == 34 && !OrgMafia(f) || GetPlayerOrg(playerid)!= 15) return SCM(playerid, -1"Only the Mafia and Al'Qaeda can sell snipers.");  
            if(
weaponid == 34) { if(ORG_SNIPERDELAY[f] > 0) { FORMAT_SSTR "ERROR: A sniper has already been mounted, wait %d minutes until another is ready.",ORG_SNIPERDELAY[f]); return SCM(playerid, -1sstring); } }  
            
////////////////////////////////////////////////////////////////////  
            
if(ProxDetectorS(5.0playeridgiveplayerid))  
            {  
                
FORMAT_SSTR "%s is offering %s to %s for R$%d.",Nome(playerid),WeaponsName[w],Nome(giveplayerid),value);  
                
SendClientMessageInRange(15.0playeridsstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);  
                
FORMAT_SSTR "You agree to buy %s weapon from %s for R$%d?",WeaponsName[w],Name(playerid),value);  
                
ShowPlayerDialog(giveplayerid,DIALOG_SELLING_WEAPON,DIALOG_STYLE_MSGBOX,"Buying weapon",sstring,"accept","refuse");  
                
BuyingWeaponPlayer[giveplayerid] = playeridBuyingWeapon[giveplayerid] = weaponidBuyingWeaponValue[giveplayerid] = value;  
            }  
            else 
SCM(playerid, -1"ERROR: Player is too far away.");  
        }  
        return 
1;  
    } 
Reply
#2

Someone can help me please?
Reply
#3

Do you get the message 'Use: /sellgun [playerid] [number] [value]' when you dont type the whole command with the required parameters?
Reply
#4

Why is 'weaponid' a string?
Reply
#5

pawn Код:
if(sscanf(params, "us[45]d", giveplayerid, weaponid, value))
Instead of that use this:
pawn Код:
if(sscanf(params, "iii", giveplayerid, weaponid, value))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)