SA-MP Forums Archive
This works...but it doesnt? - 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)
+--- Thread: This works...but it doesnt? (/showthread.php?tid=312249)



This works...but it doesnt? - Dokins - 20.01.2012

Alright, the string compare works, and it reaches the second request for house ID and displays correctly, yes theses functions definitely work (MySQL) It just wont set the integers and I have NO idea why, it returns the proxdetector.



pawn Код:
CMD:hstoreweapon(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(HouseOwned[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You don't have a house.");
    new slot, houseid, weapon[32];
    if(sscanf(params, "is[32]", slot ,weapon)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /hstoreweapon [slot] [weapon]");
    if(HouseWS1[houseid] || HouseWS2[houseid] || HouseWS3[houseid] >= 1) return SendClientMessage(playerid, COLOUR_GREY, "That slot is already occupied.");
    if(slot < 1 || slot > 3) return SendClientMessage(playerid, COLOUR_GREY, "Invalid slot (1-3).");

    houseid = GetPlayerHouseID(playerid);
    printf("SLOT: %i", slot);
    new string[128];
    if(IsPlayerInRangeOfPoint(playerid, 30.0, HouseIntX[houseid], HouseIntY[houseid], HouseIntZ[houseid]))
    {
        printf("House ID: %d", houseid);
        if(HouseOwned[playerid] == houseid)
        {
            if(!(strcmp(weapon, "9mm", true)))
            {
                printf("Weapon : %s", weapon);
                if(PlayerWeapons[playerid][2] == 22 && PlayerWeaponAmmo[playerid][2] >= 1)
                {
                    SendClientMessage(playerid, COLOUR_GREY, "You have stored a 9mm in your house.");
                    if(slot == 1)
                    {
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWS1", PlayerWeapons[playerid][2],"houses");
                        printf("Houseid: %d", houseid);
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWA1", PlayerWeaponAmmo[playerid][2],"houses");
                        RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
                    }
                    if(slot == 2)
                    {
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWS2", PlayerWeapons[playerid][2],"houses");
                        printf("Houseid: %d", houseid);
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWA2", PlayerWeaponAmmo[playerid][2],"houses");
                        RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
                    }
                    if(slot == 3)
                    {
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWS3", PlayerWeapons[playerid][2],"houses");
                        printf("Houseid: %d", houseid);
                        MySQL_SetInteger(HouseSQLID[houseid], "HouseWA3", PlayerWeaponAmmo[playerid][2],"houses");
                        RemovePlayerWeapon(playerid, PlayerWeapons[playerid][2]);
                    }
                    format(string,sizeof(string), "* %s stores a 9mm in their house.", GetNameEx(playerid));
                    ProxDetector(30.0, playerid, string, COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE,COLOUR_PURPLE);
                }
            }
                }
        }
   return 1;
}