SA-MP Forums Archive
help in a command - 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: help in a command (/showthread.php?tid=616158)



help in a command - BrianS123 - 01.09.2016

Hi

i'm trying to make a command so the player can find his door's location (/mydoor)
Код:
enum pInfo
{
    ...
    ...
    ...
    pDoor1,
    pDoor2,
    pDoor3
}
new PlayerInfo[MAX_PLAYERS][pInfo];
I'm saving the Door ID in pDoor1 or pDoor 2 or pDoor3...
Код:
CMD:ddowner(playerid, params[])
{
    new door;
    ...
    ...
    ...
    ...
    PlayerInfo[playerid][pDoor1] = door;
Using this command, i can set the Door owner, and it will saves the door id in "pDoor1"
Код:
CMD:mydoor(playerid, params[])
{
    if(PlayerInfo[playerid][pDoor1] == 1)
    {
       SetPlayerCheckpoint(playerd,DDinfo[pDoor1][Ex],DDinfo[pDoor1][Ey],DDinfo[pDoor1][Ez], 3.0);
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You don't own a door.");
    }
    return 1;
}
and this is the command, anything wrong?, the checkpoint will be placed in BlueBerry, not in the Door location..;


Re: help in a command - javedali1211 - 01.09.2016

Код:
CMD:mydoor(playerid, params[])
{
    if(PlayerInfo[playerid][pDoor1] == 1)
    {
       SetPlayerCheckpoint(playerd,DDinfo[pDoor1][Ex],DDinfo[pDoor2][Ey],DDinfo[pDoor3][Ez], 3.0);
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You don't own a door.");
    }
    return 1;
}



Re: help in a command - Shinja - 01.09.2016

I think you want this
PHP код:
CMD:mydoor(playeridparams[])
{
    if(
PlayerInfo[playerid][pDoor1] == 1)
    {
       
SetPlayerCheckpoint(playerd,DDinfo[PlayerInfo[playerid][pDoor1]][Ex],DDinfo[PlayerInfo[playerid][pDoor1]][Ey],DDinfo[PlayerInfo[playerid][pDoor1]][Ez], 3.0);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"You don't own a door.");
    }
    return 
1;




Re: help in a command - BrianS123 - 01.09.2016

Quote:
Originally Posted by javedali1211
Посмотреть сообщение
Код:
CMD:mydoor(playerid, params[])
{
    if(PlayerInfo[playerid][pDoor1] == 1)
    {
       SetPlayerCheckpoint(playerd,DDinfo[pDoor1][Ex],DDinfo[pDoor2][Ey],DDinfo[pDoor3][Ez], 3.0);
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You don't own a door.");
    }
    return 1;
}
pDoor1 = Door1 ]
pDoor2 = Door2 ] => Player can own 3doors, like, pDoor1 = Doorid 12 | pDoor2 = Doorid 13 | pDoor3 = Doorid14
PDoor3 = Door3 ]

so the player owns 3 doors (12+13+14)
if i use your command, it won't work..


Re: help in a command - BrianS123 - 01.09.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
I think you want this
PHP код:
CMD:mydoor(playeridparams[])
{
    if(
PlayerInfo[playerid][pDoor1] == 1)
    {
       
SetPlayerCheckpoint(playerd,DDinfo[PlayerInfo[playerid][pDoor1]][Ex],DDinfo[PlayerInfo[playerid][pDoor1]][Ey],DDinfo[PlayerInfo[playerid][pDoor1]][Ez], 3.0);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"You don't own a door.");
    }
    return 
1;

I'll try it.


Re: help in a command - BrianS123 - 01.09.2016

Works, Thanks alot