SA-MP Forums Archive
A small 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A small question.... (/showthread.php?tid=265344)



A small question.... - justsomeguy - 30.06.2011

Hello, I got a problem.
I got a code that is supposed to make an attached object on me:
pawn Код:
CMD:enter(playerid, params[])
{
    for(new id = 0; id < sizeof(locations); id++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, locations[id][0], locations[id][1], locations[id][2]))
        {
            if(IsPlayerInRangeOfPoint(playerid, 50, -159.69033813477,-90.585571289063,1066.5211181641))
            {
            SetPlayerAttachedObject( playerid, 0, 1349, 17, -0.571150, 1.182301, -0.020726, 90.395317, 67.863235, 359.453979, 1.000000, 1.000000, 1.000000 ); // CJ_SHTROLLY - shopping
            }
            LoadingForPlayer(playerid,1500,COLOR_GREEN);
            // teleport
            SetPlayerPos(playerid, toPoint[id][0], toPoint[id][1], toPoint[id][2]);
            SetPlayerInterior(playerid, toInterior[id]);
            isInInterior[playerid] = id;
            SendClientMessage(playerid, 0x00FF00AA, "Type /exit to exit the building");
            return 1;
        }
    }
    SendClientMessage(playerid, 0xFF0000AA, "You need to be closer to a pickup to enter a building!");
    return 1;
}
But it wont, also when i use one of these commands in game i get Server: Unknown command.
pawn Код:
CMD:BuyBackpack(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -152.7479,-72.4470,1065.8430))
    {
        SetPlayerAttachedObject( playerid, 0, 3026, 1, -0.135905, -0.035217, -0.004736, 0.000000, 0.000000, 0.000000, 0.938511, 1.195391, 1.403976 );
        GetPlayerMoney(25);
        }
    return 1;
}
CMD:BuyBeer(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
        GetPlayerMoney(5);
        }
    return 1;
}
CMD:BuySprunk(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
        GetPlayerMoney(5);
        }
    return 1;
}
CMD:BuyWhine(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
        GetPlayerMoney(5);
        }
    return 1;
}
What did i do wrong here? Can anyone give me a hand?


Re: A small question.... - justsomeguy - 01.07.2011

Time for a bump "Bump"(Ps in my country it is already 2 juli:P)


Re: A small question.... - Shadoww5 - 02.07.2011

Quote:
Originally Posted by justsomeguy
Посмотреть сообщение
pawn Код:
CMD:BuyBackpack(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -152.7479,-72.4470,1065.8430))
    {
        SetPlayerAttachedObject( playerid, 0, 3026, 1, -0.135905, -0.035217, -0.004736, 0.000000, 0.000000, 0.000000, 0.938511, 1.195391, 1.403976 );
        GetPlayerMoney(25);
        }
    return 1;
}
CMD:BuyBeer(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
        GetPlayerMoney(5);
        }
    return 1;
}
CMD:BuySprunk(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
        GetPlayerMoney(5);
        }
    return 1;
}
CMD:BuyWhine(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -166.8134,-72.7598,1065.8430))
    {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
        GetPlayerMoney(5);
        }
    return 1;
}
What did i do wrong here? Can anyone give me a hand?
PHP код:
CMD:BuyBackpack(playeridparams[])
{
    
#pragma unused params
    
if(IsPlayerInRangeOfPoint(playerid5, -152.7479,-72.4470,1065.8430))
    {
          
SetPlayerAttachedObjectplayerid030261, -0.135905, -0.035217, -0.0047360.0000000.0000000.0000000.9385111.1953911.403976 );
        
GetPlayerMoney(playerid, -25);
    }
    return 
1;
}
CMD:BuyBeer(playeridparams[])
{
    
#pragma unused params
    
if(IsPlayerInRangeOfPoint(playerid5, -166.8134,-72.7598,1065.8430))
    {
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_BEER);
        
GetPlayerMoney(playerid, -5);
    }
    return 
1;
}
CMD:BuySprunk(playeridparams[])
{
    
#pragma unused params
    
if(IsPlayerInRangeOfPoint(playerid5, -166.8134,-72.7598,1065.8430))
    {
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_SPRUNK);
        
GetPlayerMoney(playerid, -5);
    }
    return 
1;
}
CMD:BuyWhine(playeridparams[])
{
    
#pragma unused params
    
if(IsPlayerInRangeOfPoint(playerid5, -166.8134,-72.7598,1065.8430))
    {
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_WINE);
        
GetPlayerMoney(playerid, -5);
    }
    return 
1;

And what the command /enter should do?


Re: A small question.... - justsomeguy - 02.07.2011

Oke at buybackpack, you dont need to give the player a weapon as i used an attached object for it.
And /enter is for if you stand on a pickup and type: /enter that you come inside the building, but when you come at a certain building(In this case a shop) you will get an attached object onto you.


Re: A small question.... - Shadoww5 - 02.07.2011

Quote:
Originally Posted by justsomeguy
Посмотреть сообщение
Hello, I got a problem.
I got a code that is supposed to make an attached object on me:
pawn Код:
CMD:enter(playerid, params[])
{
    for(new id = 0; id < sizeof(locations); id++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, locations[id][0], locations[id][1], locations[id][2]))
        {
            if(IsPlayerInRangeOfPoint(playerid, 50, -159.69033813477,-90.585571289063,1066.5211181641))
            {
            SetPlayerAttachedObject( playerid, 0, 1349, 17, -0.571150, 1.182301, -0.020726, 90.395317, 67.863235, 359.453979, 1.000000, 1.000000, 1.000000 ); // CJ_SHTROLLY - shopping
            }
            LoadingForPlayer(playerid,1500,COLOR_GREEN);
            // teleport
            SetPlayerPos(playerid, toPoint[id][0], toPoint[id][1], toPoint[id][2]);
            SetPlayerInterior(playerid, toInterior[id]);
            isInInterior[playerid] = id;
            SendClientMessage(playerid, 0x00FF00AA, "Type /exit to exit the building");
            return 1;
        }
    }
    SendClientMessage(playerid, 0xFF0000AA, "You need to be closer to a pickup to enter a building!");
    return 1;
}
Try:

PHP код:
CMD:enter(playeridparams[])
{
    for(new 
id 0id sizeof(locations); id++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.0locations[id][0], locations[id][1], locations[id][2]))
        {
            if(
IsPlayerInRangeOfPoint(playerid50, -159.69033813477,-90.585571289063,1066.5211181641))
            {
                
SetPlayerAttachedObjectplayerid0134917, -0.5711501.182301, -0.02072690.39531767.863235359.4539791.0000001.0000001.000000 ); // CJ_SHTROLLY - shopping
            
}
            
LoadingForPlayer(playerid,1500,COLOR_GREEN);
            
// teleport
            
SetPlayerPos(playeridtoPoint[id][0], toPoint[id][1], toPoint[id][2]);
            
SetPlayerInterior(playeridtoInterior[id]);
            
isInInterior[playerid] = id;
            
SendClientMessage(playerid0x00FF00AA"Type /exit to exit the building");
        }
        else { 
SendClientMessage(playerid0xFF0000AA"You need to be closer to a pickup to enter a building!"); }
    }
    return 
1;




Re: A small question.... - justsomeguy - 02.07.2011

That didn't work, all it did was spamming "You need to be closer to a pickup to enter a builidng!" when i was not close enough to a pickup.


Re: A small question.... - =WoR=Varth - 03.07.2011

You don't need to loop.


Re: A small question.... - Scenario - 03.07.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
You don't need to loop.
With the way his system was written, it appears the loop is necessary. As for the message being spammed, it is because you are sending a message inside of a loop. The message is going to send as many times as there are "locations" (hopefully that makes sense).


Re: A small question.... - willsuckformoney - 03.07.2011

Take the capital letters out of the CMD: and it should work ingame.


Re: A small question.... - Mrminecraft202 - 03.07.2011

Send me a PM on the forums I will try and help you.