SA-MP Forums Archive
Cmd not work. - 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: Cmd not work. (/showthread.php?tid=517224)



Cmd not work. - TheSy - 03.06.2014

xxxxxxxxxxxx


Re: Cmd not work. - Threshold - 04.06.2014

pawn Код:
if(!strcmp(cmd, "/ramasser", true))
    {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_ROUGE_CLAIR, "Impossible depuis un vйhicule.");
        new world = GetPlayerVirtualWorld(playerid), int = GetPlayerInterior(playerid);
        for(new i = 0; i < sizeof(ObjetsInfo); i++)
        {
            if(!IsPlayerInRangeOfPoint(playerid, 1.0, ObjetsInfo[i][PosX], ObjetsInfo[i][PosY], ObjetsInfo[i][PosZ])) continue;
            if(ObjetsInfo[i][VW] != world) continue;
            if(ObjetsInfo[i][Inte] != int) continue;
            if(ObjetsAuSol[i] != INVALID_OBJECT_ID)
            {
                DestroyDynamicObject(ObjetsAuSol[i]);
                ObjectsAuSol[i] = INVALID_OBJECT_ID;
            }
            new ostr[85];
            ObjetsInfo[i][ID] = 0;
            ObjetsInfo[i][IDOBJET] = 0;
            ObjetsInfo[i][PosX] = 0;
            ObjetsInfo[i][PosY] = 0;
            ObjetsInfo[i][PosZ] = 0;
            if(ObjetsInfo[i][QteMatos])
            {
                format(ostr, sizeof(ostr), "Vous venez de ramasser %d matйriels dans un paquet au sol.", ObjetsInfo[i][QteMatos]);
                SendClientMessage(playerid, COLOR_RPIT, ostr);
                ObjetsInfo[i][QteMatos] = 0;
            }
            if(ObjetsInfo[i][IdArme])
            {
                format(ostr, sizeof(ostr), "Vous venez de ramasser une arme au sol contenant %d munitions.", ObjetsInfo[i][Ammo]);
                SendClientMessage(playerid, COLOR_RPIT, ostr);
                SafeGivePlayerWeapon(playerid, ObjetsInfo[i][IdArme], ObjetsInfo[i][Ammo]);
                ObjetsInfo[i][IdArme] = 0;
                ObjetsInfo[i][Ammo] = 0;
            }
            if(ObjetsInfo[i][SommeArgent])
            {
                format(ostr, sizeof(ostr), "Vous venez de ramasser une liasse de $%d au sol.", ObjetsInfo[i][SommeArgent]);
                SendClientMessage(playerid, COLOR_RPIT, ostr);
                SafeGivePlayerMoney(playerid, ObjetsInfo[i][SommeArgent]);
                ObjetsInfo[i][SommeArgent] = 0;
            }
            switch(ObjetsInfo[i][VarieteWeed])
            {
                case 1:
                {
                    PlayerInfo[playerid][pGrammesAmne] += ObjetsInfo[i][GrammesWeed];
                    format(ostr, sizeof(ostr), "Vous venez de ramasser %d grammes d'Amnйsia dans un sachet au sol.", ObjetsInfo[i][GrammesWeed]);
                }
                case 2:
                {
                    PlayerInfo[playerid][pGrammesSkunk] += ObjetsInfo[i][GrammesWeed];
                    format(ostr, sizeof(ostr), "Vous venez de ramasser %d grammes de Skunk dans un sachet au sol.", ObjetsInfo[i][GrammesWeed]);
                }
                case 3:
                {
                    PlayerInfo[playerid][pGrammesWhiteW] += ObjetsInfo[i][GrammesWeed];
                    format(ostr, sizeof(ostr), "Vous venez de ramasser %d grammes de White Widow dans un sachet au sol.", ObjetsInfo[i][GrammesWeed]);
                }
                default:
                {
                    ObjetsInfo[i][VarieteWeed] = 0;
                    ObjetsInfo[i][GrammesWeed] = 0;
                    format(ostr, sizeof(ostr), "DELETE FROM `srp_players_objets` WHERE ID=%d", i);
                    mysql_query(ostr);
                    continue;
                }
            }
            SendClientMessage(playerid, COLOR_RPIT, ostr);
            ObjetsInfo[i][VarieteWeed] = 0;
            ObjetsInfo[i][GrammesWeed] = 0;
            format(ostr, sizeof(ostr), "DELETE FROM `srp_players_objets` WHERE ID=%d", i);
            mysql_query(ostr);
        }
        return 1;
    }
I'm not very skilled with MySQL, so I'm not sure if the query is incorrect or not.


Re: Cmd not work. - TheSy - 04.06.2014

pawn Код:
if(ObjetsInfo[i][VW] != world) continue;
Why? ._.


Re: Cmd not work. - Threshold - 04.06.2014

If the object's virtual world isn't the same as the player's virtual world, it skips the object and moves onto the next one.


Re: Cmd not work. - TheSy - 04.06.2014

xxxxxxxxxx


Re: Cmd not work. - Threshold - 04.06.2014

Uh, that's not even the command that you originally posted..


Re: Cmd not work. - TheSy - 04.06.2014

Yes, I know.

The command I posted is to pick up the object, but even after you change it does not always work (I write /ramasser but it does not matter).

So the concern may be when the object is placed (So the order posted last).


Re: Cmd not work. - TheSy - 04.06.2014

upppp


Re: Cmd not work. - TheSy - 04.06.2014

+reps for your help !!