Pickup's [ MySql ]
#1

- Pickup's
Good evening everyone, im trying to make an /enter command with pickup's fetched from a database.

Here's the command itself:
pawn Код:
dcmd_enter(playerid,params[])
{
    #pragma unused params
    for(new i; i < MAX_PICKUPS; i++)
    {
        player[playerid][Entered] = 0;
        if(PlayerToPoint(playerid, 3,Pickups[i][uX],Pickups[i][uY],Pickups[i][uZ]))
        {
            SetPlayerInterior(playerid, Pickups[i][uInt]);
            SetPlayerVirtualWorld(playerid,Pickups[i][uWorldid]);
            SetPlayerPos(playerid, Pickups[i][uEx], Pickups[i][uEy], Pickups[i][uEz]);
            player[playerid][Entered] = i;
            printf("return 1");
        }
    }
    if(player[playerid][Entered] == 0)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "( ! ) You have to be near an building to enter it.");
    }
    else return 1;
    return 1;
}
When typing over an pickup it works, but if player isn't in range the it return's unknown cmd.
this is highly needed as i don't want to make two commands to enter /enter and /housenter would be messy.
thanks all

Iv'e tested with prints to see if everything gets fetched to the vars and it does..
Reply
#2

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
- Pickup's
Good evening everyone, im trying to make an /enter command with pickup's fetched from a database.
I dont see why you mentioned "MYSQL".. anyways try this:

pawn Код:
dcmd_enter(playerid,params[])
{
    #pragma unused params
   
    for(new i; i < MAX_PICKUPS; i++)
    {
    player[playerid][Entered] = 0;
    if(PlayerToPoint(playerid, 3,Pickups[i][uX],Pickups[i][uY],Pickups[i][uZ]))
        {
            SetPlayerInterior(playerid, Pickups[i][uInt]);
            SetPlayerVirtualWorld(playerid,Pickups[i][uWorldid]);
            SetPlayerPos(playerid, Pickups[i][uEx], Pickups[i][uEy], Pickups[i][uEz]);
            player[playerid][Entered] = i;
        }
    }
    if(player[playerid][Entered] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "( ! ) You have to be near an building to enter it.");
    return 1;
}
If it does not work use https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup.

Rafstar ®
Reply
#3

I'm not sure why i did either , anyway still return Unknown command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)