SA-MP Forums Archive
Warning code, and a 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: Warning code, and a question. (/showthread.php?tid=446495)



Warning code, and a question. - CLT - 26.06.2013

Hello guys, I've a warning with my pickup code, if you could help me to fix it it'll be awsome

Here's the warning.
pawn Код:
C:\Users\user\Desktop\Hazard Gaming\HZG V1.0\gamemodes\Hazard.pwn(685) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
And here's the code;
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    {
    if(pickupid == LSPD)

    SetPlayerPos(playerid, -1402.2529,-134.3108,14.1484);
    SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    return 1;
    }
   
    { // <------- Line 685 (The warning is here.)
    if(pickupid == FBI)
    SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    return 1;
    }
}
And another question is, if I use a /TPHERE command, it teleports just the player without the vehicle, how could I possibly fix it and make him teleport WITH the vehicle?

Thanks ahead



Re: Warning code, and a question. - Cjgogo - 26.06.2013

Again me, xD, this should do it:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == LSPD)
    {
        SetPlayerPos(playerid, -1402.2529,-134.3108,14.1484);
        SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    if(pickupid == FBI)
    {
        SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
}



AW: Warning code, and a question. - Skimmer - 26.06.2013

This will work

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == LSPD)
    {
        SetPlayerPos(playerid, -1402.2529,-134.3108,14.1484);
        SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    if(pickupid == FBI)
    {
        SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    return 1;
}



Re: AW: Warning code, and a question. - CLT - 26.06.2013

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Again me, xD, this should do it:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == LSPD)
    {
        SetPlayerPos(playerid, -1402.2529,-134.3108,14.1484);
        SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    if(pickupid == FBI)
    {
        SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
}
Hehe, thanks again !

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
This will work

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == LSPD)
    {
        SetPlayerPos(playerid, -1402.2529,-134.3108,14.1484);
        SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    if(pickupid == FBI)
    {
        SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
    }
    return 1;
}
Thank you, it worked the code is readable, but the "LSPD" pickup now does both lines of the FBI...
Which means the FBI pickup doesn't do anything, but the LSPD one does both,


pawn Код:
SendClientMessage(playerid, COLOR_BLUE, "You've chosen to become an officer, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've chosen to become an agent, proceed to the next checkpoint to continue, unless you'll prefer to use /home.");
SetPlayerPos(playerid, 1786.4082,-1298.6226,120.2656);
Lol how do I fix it, sorry for all the questions am new to scripting, I'll rep


AW: Warning code, and a question. - Skimmer - 26.06.2013

Show me the code where you created the pickups, below OnGameModeInit.


Re: Warning code, and a question. - CLT - 26.06.2013

pawn Код:
//-------------------------[PICKUPs]-------------------------------------//
    CreatePickup(1247, 1, -1392.0496,-139.6154,14.1484, 0); //LSPD Pickup
    Create3DTextLabel("LSPD Headquarters:\nEnter the checkpoint to visit.", COLOR_BLUE, -1392.0496,-139.6154,15.000, 40, 0, 0); //LSPD Pickup
    // New -------------------------------------------------------
    CreatePickup(1247, 1, -1380.3254,-147.4823,14.1484, 0);
    Create3DTextLabel("FBI Headquarters:\n Enter the checkpoint to visit.", COLOR_LIGHTBLUE, -1380.3254,-147.4823,15.000, 40, 0, 0);
Here


AW: Warning code, and a question. - Skimmer - 26.06.2013

Well there is your problem change it to

pawn Код:
//-------------------------[PICKUPs]-------------------------------------//
    LSPD = CreatePickup(1247, 1, -1392.0496,-139.6154,14.1484, 0); //LSPD Pickup
    Create3DTextLabel("LSPD Headquarters:\nEnter the checkpoint to visit.", COLOR_BLUE, -1392.0496,-139.6154,15.000, 40, 0, 0); //LSPD Pickup
    // New -------------------------------------------------------
    FBI = CreatePickup(1247, 1, -1380.3254,-147.4823,14.1484, 0);
    Create3DTextLabel("FBI Headquarters:\n Enter the checkpoint to visit.", COLOR_LIGHTBLUE, -1380.3254,-147.4823,15.000, 40, 0, 0);



Re: AW: Warning code, and a question. - CLT - 26.06.2013

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
Well there is your problem change it to

pawn Код:
//-------------------------[PICKUPs]-------------------------------------//
    LSPD = CreatePickup(1247, 1, -1392.0496,-139.6154,14.1484, 0); //LSPD Pickup
    Create3DTextLabel("LSPD Headquarters:\nEnter the checkpoint to visit.", COLOR_BLUE, -1392.0496,-139.6154,15.000, 40, 0, 0); //LSPD Pickup
    // New -------------------------------------------------------
    FBI = CreatePickup(1247, 1, -1380.3254,-147.4823,14.1484, 0);
    Create3DTextLabel("FBI Headquarters:\n Enter the checkpoint to visit.", COLOR_LIGHTBLUE, -1380.3254,-147.4823,15.000, 40, 0, 0);
Still didn't work, the same thing happens again.

Here's a pic:





AW: Warning code, and a question. - Skimmer - 26.06.2013

Hmm, not sure, but the Pickup Types seems to be changed.

pawn Код:
1 = Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY.
Can you try another type? Maybe 2 or 19


Re: AW: Warning code, and a question. - CLT - 26.06.2013

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
Hmm, not sure, but the Pickup Types seems to be changed.

pawn Код:
1 = Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY.
Can you try another type? Maybe 2 or 19
Tried with 2, didn't work :O, lol am really stuck..