SA-MP Forums Archive
[HELP] Sniper Laser - 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: [HELP] Sniper Laser (/showthread.php?tid=205818)



[HELP] Sniper Laser - Larsey123IsMe - 02.01.2011

Why does the laser dont follow my scope?

can someone just correct it?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/addlaser", cmdtext, true, 10) == 0)
    {
        if(GetPlayerWeapon(playerid) == 34)
        {
            SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
            return 1;
        } else return SendClientMessage(playerid, COLOR_GREEN, "You cannot add a laser to this weapon!");
    }
    return 0;
}



Re: [HELP] Sniper Laser - HyperZ - 02.01.2011

Have you tested this?
pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
{
       if(GetPlayerWeapon(playerid) == 34)
       {
       SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
       } else return SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
}



Re: [HELP] Sniper Laser - Larsey123IsMe - 02.01.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
Have you tested this?
pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
{
       if(GetPlayerWeapon(playerid) == 34)
       {
       SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
       } else return SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
}
What did you change? :S


Re: [HELP] Sniper Laser - HyperZ - 02.01.2011

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
What did you change? :S
pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
    {
        if(GetPlayerWeapon(playerid) == 34)
        {
            SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
            return 1;
        } else return SendClientMessage(playerid, COLOR_GREEN, "You cannot add a laser to this weapon!");
    }
To:
pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
{
       if(GetPlayerWeapon(playerid) == 34)
       {
       SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
       } else return SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
}



Re: [HELP] Sniper Laser - Larsey123IsMe - 02.01.2011

without "return 1;" it says "SERVER: Unknown Command" after i typed "/addlaser"..........


Re: [HELP] Sniper Laser - HyperZ - 02.01.2011

Ok then try this:

pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
    {
       SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
       return 1;
    }



Re: [HELP] Sniper Laser - Larsey123IsMe - 02.01.2011

What have the "return 1;" to do with my question?


Re: [HELP] Sniper Laser - HyperZ - 02.01.2011

Tested and working:
pawn Код:
if (strcmp("/addlaser", cmdtext, true, 10) == 0)
    {
    if(GetPlayerWeapon(playerid) == 34) SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
    else
    {
    SetPlayerAttachedObject(playerid,3 , 18643, 6, 0.158249, 0.010233, 0.128052, 6.868255, 351.962524, 356.884216);
    }
    return 1;
    }



Re: [HELP] Sniper Laser - Larsey123IsMe - 02.01.2011

How can that work...


pawn Код:
if(GetPlayerWeapon(playerid) == 34) SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
If i have the weapon "34" (sniper)... then this message returns "You cannot add a laser to this weapon!" and block rest of the code...


Re: [HELP] Sniper Laser - HyperZ - 02.01.2011

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
How can that work...


pawn Код:
if(GetPlayerWeapon(playerid) == 34) SendClientMessage(playerid, 0x660066AA, "You cannot add a laser to this weapon!");
If i have the weapon "34" (sniper)... then this message returns "You cannot add a laser to this weapon!" and block rest of the code...
can someone just correct it?