[HELP] Sniper Laser
#1

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;
}
Reply
#2

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!");
}
Reply
#3

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
Reply
#4

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!");
}
Reply
#5

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

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;
    }
Reply
#7

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

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;
    }
Reply
#9

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...
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)