IsPlayerinrangeof point help
#1

ok i have this cmd

pawn Код:
CMD:randomtune(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not in the driver seat!");
    else if(GetPlayerCash(playerid) <= 99999) return SendClientMessageEx(playerid, COLOR_WHITE, "You need $500,000 to randomly tune this vehicle!");

    else if(IsWarned[playerid] == 0)
    {
        SendClientMessageEx(playerid, COLOR_REALRED, "Warning: This will remove $500,000 from you, and apply random modifications (No Refunds on what you get)");
        SendClientMessageEx(playerid, COLOR_RED, "Warning: Also if this isn't a player owned car the modifications will not save,");
        SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: Type the command again to continue.");
        IsWarned[playerid] = 1;
    }
    else
    {
        IsWarned[playerid] = 0;
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        GivePlayerCash(playerid, -500000);
        TuneVehicleRandomly(vehicleid);
        //AddVehicleComponent(GetPlayerVehicleID(playerid),1080); dont want them to get gold rims also makes it less random- Shadow
        SendClientMessageEx(playerid, COLOR_WHITE, "You have randomly tuned this vehicle");
        SendClientMessageEx(playerid, COLOR_RED, "Remember to /park to make them save if its a player owned vehicle");
    }
    return 1;
}
i need someone to edit it so it wont work if they arent in the radius of X,Y,Z and also send a message if they aren't like erro not in range please help
Reply
#2

What??

Read it: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

What do you want to do in the script?
Reply
#3

have it so they cant use the CMD unless they are in range of the point
Reply
#4

From what I remember it's something like this...
I'm only new to scripting and from what I can remember I think this is sorta how you do it, ask a old scripter for my help.

pawn Код:
CMD:randomtune(playerid, params[])
{
   if(IsPlayerInRangeOfPoint(playerid,( Distance around the around you want it at, like 10. ), X, Y, Z)) return SendClientMessage(playerid, -1, "You are not near the randomtune area!");
 if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not in the driver seat!");
    else if(GetPlayerCash(playerid) <= 99999) return SendClientMessageEx(playerid, COLOR_WHITE, "You need $500,000 to randomly tune this vehicle!");

    else if(IsWarned[playerid] == 0)
    {
        SendClientMessageEx(playerid, COLOR_REALRED, "Warning: This will remove $500,000 from you, and apply random modifications (No Refunds on what you get)");
        SendClientMessageEx(playerid, COLOR_RED, "Warning: Also if this isn't a player owned car the modifications will not save,");
        SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: Type the command again to continue.");
        IsWarned[playerid] = 1;
    }
    else
    {
        IsWarned[playerid] = 0;
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        GivePlayerCash(playerid, -500000);
        TuneVehicleRandomly(vehicleid);
        //AddVehicleComponent(GetPlayerVehicleID(playerid),1080); dont want them to get gold rims also makes it less random- Shadow
        SendClientMessageEx(playerid, COLOR_WHITE, "You have randomly tuned this vehicle");
        SendClientMessageEx(playerid, COLOR_RED, "Remember to /park to make them save if its a player owned vehicle");
    }
    return 1;
}
i
Reply
#5

pawn Код:
// in case the player is in the pos X,Y,Z with 10.0 of range.
if(IsPlayerInRangeOfPoint(playerid, 10.0 , X , Y , Z )) return SendClientMessage(playerid, -1 ,#You're in the POS X,Y,Z);


// in case the player is NOT in the pos X,Y,Z with 10.0 of range.
// note here, we have a NOT function, which is declared by "!" before the function.
if(!IsPlayerInRangeOfPoint(playerid, 10.0 , X , Y , Z )) return SendClientMessage(playerid, -1 ,#You're NOT in the POS X,Y,Z);

//Both functions gonna stop when get called, since there's a return in them.
Socan, your case is the first one, isn't what he is looking.
Reply
#6

Sorry, but I dont understand that..
Reply
#7

Which part? i could explain it better for you.
Reply
#8

Got skype? Add me at jim_mcb_99 and we can speak.
Reply
#9

Yes i have it, but i won't go to skype, or even add you.

I don't like to add unknown people to help, if you has doubts about something, tell me i could explain it Only via forum.
Reply
#10

pawn Код:
CMD:randomtune(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 10.0, Float:x, Float:y, Float:z))
    {
        if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not in the driver seat!");
        else if(GetPlayerCash(playerid) <= 99999) return SendClientMessageEx(playerid, COLOR_WHITE, "You need $500,000 to randomly tune this vehicle!");
        else if(IsWarned[playerid] == 0)
        {
            SendClientMessageEx(playerid, COLOR_REALRED, "Warning: This will remove $500,000 from you, and apply random modifications (No Refunds on what you get)");
            SendClientMessageEx(playerid, COLOR_RED, "Warning: Also if this isn't a player owned car the modifications will not save,");
            SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: Type the command again to continue.");
            IsWarned[playerid] = 1;
        }
        else
        {
            IsWarned[playerid] = 0;
            new vehicleid;
            vehicleid = GetPlayerVehicleID(playerid);
            GivePlayerCash(playerid, -500000);
            TuneVehicleRandomly(vehicleid);
            //AddVehicleComponent(GetPlayerVehicleID(playerid),1080); dont want them to get gold rims also makes it less random- Shadow
            SendClientMessageEx(playerid, COLOR_WHITE, "You have randomly tuned this vehicle");
            SendClientMessageEx(playerid, COLOR_RED, "Remember to /park to make them save if its a player owned vehicle");
        }
        else return SendClientMessage(playerid, -1, "You're not in the rangeofpoint!");
    }
    return 1;
}
Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
Yes i have it, but i won't go to skype, or even add you.

I don't like to add unknown people to help, if you has doubts about something, tell me i could explain it Only via forum.
agreed with you leo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)