SA-MP Forums Archive
gun ID and Ammo - 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: gun ID and Ammo (/showthread.php?tid=157104)



gun ID and Ammo - Typhome - 05.07.2010

pawn Код:
else if(strcmp(x_nr,"relv",true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /anna gun [playerid/PartOfName]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(ProxDetectorS(5.0, playerid, giveplayerid))
                        {
                            new gunID = GetPlayerWeapon(playerid);
                            new gunAmmo = GetPlayerAmmo(playerid);

                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

                            if(gunID != 0 && gunAmmo != 0)
                            {
                                //SafeGivePlayerWeapon(giveplayerid, gunID, gunAmmo);
                                RemovePlayerWeapon(playerid, gunID);
                                RelvNimi[playerid] = gunID;
                                RelvKuul[playerid] = gunAmmo;
                                RelvSaam[playerid] = 1;
                                format(string, sizeof(string), "[SЬSTEEM] %s tahab anda sulle relvi. [Relv: %d || Laskemoon: %d]", gunID, gunAmmo);
                                SendClientMessage(giveplayerid, COLOR_WHITE, string);
                                SendClientMessage(giveplayerid, COLOR_WHITE, "[SЬSTEEM] Kui tahad nхustuda relva andmist, siis kirjuta /nхustu relv.");
                                format(string, sizeof(string), "* %s annab oma relva %s.", sendername, giveplayer);
                                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                                return 1;
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_GREY, "Sul ei ole relvi, et mida anda!");
                                return 1;
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Mдngija ei ole sinu lдhedal!");
                            return 1;
                        }
                    }
                }
            }
I have gun ID 6, then shows it -1

[SЬSTEEM] %s tahab anda sulle relvi. [Relv: %d || Laskemoon: %d]", gunID, gunAmmo

I think %d is wrong.

I have minigun and giving to him, then shows:
[SЬSTEEM] Alex tahab anda sulle relvi. [Relv: 500 || Laskemoon: 0]

must be

[SЬSTEEM] Alex tahab anda sulle relvi. [Relv: 38 || Laskemoon: 100]

38 is minigun ID
100 is ammo


Re: gun ID and Ammo - [LDT]LuxurY - 05.07.2010

so? what's the problem?


Re: gun ID and Ammo - Typhome - 05.07.2010

Quote:
Originally Posted by [LDT]LuxurY
Посмотреть сообщение
so? what's the problem?
Added.. First post.


Re: gun ID and Ammo - [LDT]LuxurY - 05.07.2010

may be:
PHP код:
format(stringsizeof(string), "[SЬSTEEM] %s tahab anda sulle relvi. [Relv: %d || Laskemoon: %d]"sendernamegunIDgunAmmo); 



Re: gun ID and Ammo - Typhome - 05.07.2010

Quote:
Originally Posted by [LDT]LuxurY
Посмотреть сообщение
may be:
PHP код:
format(stringsizeof(string), "[SЬSTEEM] %s tahab anda sulle relvi. [Relv: %d || Laskemoon: %d]"sendernamegunIDgunAmmo); 
Ohdamnit. Yeah, but its all correct?


Re: gun ID and Ammo - [LDT]LuxurY - 05.07.2010

Quote:
Originally Posted by Typhome
Посмотреть сообщение
Ohdamnit. Yeah, but its all correct?
expected to be