SA-MP Forums Archive
Glasses - Small Question - 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: Glasses - Small Question (/showthread.php?tid=354351)



Glasses - Small Question - Dan_Barocu - 26.06.2012

hello i created a /glasses cmd but i have a problem "how can i do /glasses to put on glasses and take them off?and with the glasses that i bought, i really need this answer its getting me mad..

PHP код:
if (strcmp("/glasses"cmdtexttrue10) == 0)
                    {
                        
//Setglasseid[playerid]
                        
if(PlayerInfo[playerid][pGlasses] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"WARNING: You do not have any glasses!"); // It will check if the character has any glasses in his savelog and if he hasn't it will send him a message.
                        
if(glasses[playerid] == false)
                        {
                             
SetPlayerHoldingObject(playeridglasseid2SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                             
glasses[playerid] = true;
                        }
                        else if(
glasses[playerid] == true)
                        {
                             if(
IsPlayerAttachedObjectSlotUsed(playerid1)) RemovePlayerAttachedObject(playerid,1);
                             
glasses[playerid] = false;
                        }
                        return 
1;
                    } 



Re: Glasses - Small Question - Grand_Micha - 26.06.2012

pawn Код:
if (strcmp("/glasses", cmdtext, true, 10) == 0)
                    {
                        //Setglasseid[playerid]
                        if(PlayerInfo[playerid][pGlasses] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have any glasses!");
                        if(glasses[playerid] == false)
                        {
                            SetPlayerAttachedObject(playerid, 2, glasseid, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                            glasses[playerid] = true;
                        }
                        else if(glasses[playerid] == true)
                        {
                            if(IsPlayerAttachedObjectSlotUsed(playerid, 2)) RemovePlayerAttachedObject(playerid,2);
                            glasses[playerid] = false;
                        }
                        return 1;
                    }
Also, click here for more info.


Re: Glasses - Small Question - Dan_Barocu - 26.06.2012

Quote:
Originally Posted by Grand_Micha
Посмотреть сообщение
pawn Код:
if (strcmp("/glasses", cmdtext, true, 10) == 0)
                    {
                        //Setglasseid[playerid]
                        if(PlayerInfo[playerid][pGlasses] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have any glasses!");
                        if(glasses[playerid] == false)
                        {
                            SetPlayerAttachedObject(playerid, 2, glasseid, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                            glasses[playerid] = true;
                        }
                        else if(glasses[playerid] == true)
                        {
                            if(IsPlayerAttachedObjectSlotUsed(playerid, 2)) RemovePlayerAttachedObject(playerid,2);
                            glasses[playerid] = false;
                        }
                        return 1;
                    }
Also, click here for more info.
PHP код:
SetPlayerAttachedObject(playerid2glasseidSkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]); === Tag mismatch



Re: Glasses - Small Question - Grand_Micha - 26.06.2012

pawn Код:
SetPlayerAttachedObject(playerid, 2, glasseid,2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
Oopsydaisy, my bad.


Re: Glasses - Small Question - Dan_Barocu - 26.06.2012

doesent work no errors just no work..


Re: Glasses - Small Question - Grand_Micha - 26.06.2012

Then your offsets are obviously wrong. Also, check "glasseid."


Re: Glasses - Small Question - Dan_Barocu - 26.06.2012

HERE:

pawn Код:
if(!strcmp("/buyochelari",cmd,true))
                    {
                    if(PlayerToPoint(3.0,playerid,1030.5072,-977.4466,42.9841))
                    {
                        tmp = strtok(cmdtext, idx);
                        skin = GetPlayerSkin(playerid);
                        id = strval(tmp);
                        if(!id || id > 33) return SendClientMessage(playerid, 0xFFFFFFAA, "{FFFFFF}/buyochelari [1-33]");
                        GivePlayerCash(playerid, -100);
                        //glasseid(playerid) = "the current chosen glass id");
                        if(id > 30) goto PutPoliceGlasses;
                        else
                        {
                            id--;
                            glasseid =  CommonRed + id;
                            SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                            return 1;
                        }
                        PutPoliceGlasses:
                        glasseid = CopGlassesBlack + (id - 31);
                        SetPlayerHoldingObject(playerid, glasseid, 2, SkinOffSet[skin][0], floatadd(SkinOffSet[skin][1], 0.004500), SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                        return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_RED, " Nu esti la Magazinul de Haine/Ochelari/Sapci! ");
                        }
                        return true;
                    }
PHP код:
Oncommandtext:  new glasseidskinid



Re: Glasses - Small Question - Grand_Micha - 26.06.2012

I don't want to see that non-English RP bullshit. Use my damn code. Keep in mind that you use PlayerToPoint.


Re: Glasses - Small Question - Dan_Barocu - 26.06.2012

Micha /buyochleari is with!

PHP код:
if (strcmp("/glasses"cmdtexttrue10) == 0)
                    {
                        
//Setglasseid[playerid]
                        
if(PlayerInfo[playerid][pGlasses] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"WARNING: You do not have any glasses!"); // It will check if the character has any glasses in his savelog and if he hasn't it will send him a message.
                        
if(glasses[playerid] == false)
                        {
                            
SetPlayerAttachedObject(playerid2glasseid,2SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                             
glasses[playerid] = true;
                        }
                        else if(
glasses[playerid] == true)
                        {
                             if(
IsPlayerAttachedObjectSlotUsed(playerid1)) RemovePlayerAttachedObject(playerid,1);
                             
glasses[playerid] = false;
                        }
                        return 
1;
                    } 



Re: Glasses - Small Question - Grand_Micha - 26.06.2012

pawn Код:
if (strcmp("/glasses", cmdtext, true, 10) == 0)
                    {
                        if(PlayerInfo[playerid][pGlasses] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have any glasses!"); // It will check if the character has any glasses in his savelog and if he hasn't it will send him a message.
                        if(glasses[playerid] == false)
                        {
                            SetPlayerAttachedObject(playerid, 2, glasseid,2, SkinOffSet[skin][0], SkinOffSet[skin][1], SkinOffSet[skin][2], SkinOffSet[skin][3], SkinOffSet[skin][4], SkinOffSet[skin][5]);
                             glasses[playerid] = true;
                        }
                        else if(glasses[playerid] == true)
                        {
                             if(IsPlayerAttachedObjectSlotUsed(playerid, 2)) RemovePlayerAttachedObject(playerid,2);
                             glasses[playerid] = false;
                        }
                        return 1;
                    }
And check YOUR OFFSETS.