Help Ineed
#1

how to make a icon infront of a door then have a command say enter then setplayerpos into the building
Reply
#2

create a pickup in front of the door, then display gametext or a textdraw when the player is near that position.
Reply
#3

no not that one it some with setplayerpos then i have to put if player in range(x,y,z,) THEN setplayerinterior
Reply
#4

Let me give you a more exactly code:

First of all, you define the 2 pickups (1 for outside and 1 for inside)
pawn Код:
new pdpickup1; // PD Main entrance outside
new pdpickup2; // PD Main entrance inside
Now, after we defined them, we want to create the pickups. Put this OnGameModeInit
pawn Код:
pdpickup1 = CreatePickup(1239, 1, 1555.4861, -1675.3259, 16.1953, -1);
pdpickup2 = CreatePickup(1239, 1, 246.7955, 62.3329, 1003.6406, -1);
Alright, so we created the pickups ... but what next? Well, we can continue in 2 steps: First one, create a 3d text, which`ll 'float' right over the pickup ... or we can make it, so when player pickup the pickup, it`ll show them a text, saying something like: "Use /enter to get inside". Well, I`ll show you both anyway:

Still under OnGameModeInit:
pawn Код:
Create3DTextLabel( "Use /enter to get inside\nLos Santos Police Department.", -1, 1555.4861, -1675.3259, 16.1953, 10.0, 0, 1 );
Create3DTextLabel( "Use /exit to get outside\nLos Santos Police Department.", -1, 246.7955, 62.3329, 1003.6406, 10.0, 0, 1 );
Or, if you want the other method, try like:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if( pickupid == pdpickup1 ) GameTextForPlayer( playerid, "~w~Use ~r~/enter ~w~to go inside the ~n~~b~Police Department~w~.", 2000, 3 ); // PD Outside
    if( pickupid == pdpickup2 ) GameTextForPlayer( playerid, "~w~Use ~r~/exit ~w~to get outside ~n~~b~Police Department~w~.", 2000, 3 ); // PD Inside
    return 1;
}
Alright, till now, all we have, are the pickups, 3dtext which floats over the pickup and a gametext for players who pickup the pickup.

Next, we`ll create the command:
STRCMP:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enter", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInRangeOfPoint( playerid, 1.5, 1555.4861, -1675.3259, 16.1953 ) )
           {
                 if(!IsPlayerInAnyVehicle( playerid ) )
                {
                        SetPlayerInterior( playerid, 6 );
                        SetPlayerPos( playerid, 246.7840, 63.9002, 1003.6406 );
                            return 1;
                    }
                 else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
           }
    }
    if (strcmp("/exit", cmdtext, true, 5) == 0)
    {
        if(IsPlayerInRangeOfPoint( playerid, 1.5, 246.7955, 62.3329, 1003.6406 ) )
           {
                 if(!IsPlayerInAnyVehicle( playerid ) )
                {
                        SetPlayerInterior(playerid, 0);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerPos(playerid, 1553.2699, -1675.4012, 16.1953);
                            return 1;
                    }
                 else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
           }
    }
    return 0;
}
Now, we are pretty much done.
Reply
#5

yes that is it thanks
Reply
#6

C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(351) : error 017: undefined symbol "cmdtext"
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(359) : warning 217: loose indentation
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(364) : error 017: undefined symbol "cmdtext"
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(373) : warning 217: loose indentation
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(82 : error 021: symbol already defined: "OnPlayerPickUpPickup"

i got these error
Reply
#7

Ahh ... never heard about that error (undefined 'cmdtext', I mean, I know what it means .. ). What server are you using? 0.3c ? If not, try downloading the latest SA-MP server from their official site ...

About the last error, you don`t have to create a new OnPlayerPickupPickUp function ... it`s already defined in your script. Use CTRL + F to search and type OnPlayerPickupPickup. Now, you`ll find two, the one you just copied from the forums, delete it and paste the code I wrote you in your function.
Reply
#8

i am using 0.3c R2
Reply
#9

Well, try to copy ONLY my commands in your "OnPlayerCommandText" function. Like:
pawn Код:
if (strcmp("/enter", cmdtext, true, 6) == 0)
    {
        if(IsPlayerInRangeOfPoint( playerid, 1.5, 1555.4861, -1675.3259, 16.1953 ) )
           {
                 if(!IsPlayerInAnyVehicle( playerid ) )
                {
                        SetPlayerInterior( playerid, 6 );
                        SetPlayerPos( playerid, 246.7840, 63.9002, 1003.6406 );
                            return 1;
                    }
                 else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
           }
    }
    if (strcmp("/exit", cmdtext, true, 5) == 0)
    {
        if(IsPlayerInRangeOfPoint( playerid, 1.5, 246.7955, 62.3329, 1003.6406 ) )
           {
                 if(!IsPlayerInAnyVehicle( playerid ) )
                {
                        SetPlayerInterior(playerid, 0);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerPos(playerid, 1553.2699, -1675.4012, 16.1953);
                            return 1;
                    }
                 else return SendClientMessage( playerid, -1, "You must get out of the vehicle first." );
           }
    }
Reply
#10

AM only getting these error now



C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(343) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(343) : error 029: invalid expression, assumed zero
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(345) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(347) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(349) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(353) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(355) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(35 : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(360) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(362) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(367) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(369) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(372) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(827) : error 021: symbol already defined: "OnPlayerPickUpPickup"
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(832) : error 010: invalid function or declaration
C:\Users\Charles\Desktop\New folder\gamemodes\ABM.pwn(836) : error 021: symbol already defined: "OnPlayerClickPlayer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


16 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)