Need help with PNS command!
#1

I need help with my pns command, i wanted to make the command that when a player is near the pay n spray and typer /paranda (/repair in english) then his vehicle teleports in to the PNS freezes for a time amount and then teleports out and takes his money, but when i try the command all the stuff like you arent near it and arent in a vehicle and no money works but the command itself doesnt do anything, no freezing no nothing. Really need help.

Command:

Код:
CMD:paranda(playerid, params[])
{
    new PlayerState = GetPlayerState(playerid);
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2075.6091,-1831.4385,13.5545))
    {
        if (PlayerState == PLAYER_STATE_PASSENGER || PlayerState == PLAYER_STATE_ONFOOT)
        {
		    SendClientMessage(playerid, COLOR_RED, "Sa ei saa parandusse siseneda jala/kхrvalistujana!");
		    return 1;
	    }
	    else if(PlayerState == PLAYER_STATE_DRIVER)
	    {
            if(GetPlayerMoney(playerid) <3500) return SendClientMessage(playerid,COLOR_RED, "Sul ei ole piisavalt raha masina parandamiseks! [3500 krooni]");
            if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehiclePos(playerid, 2065.4656,-1831.3871,13.3786);
            }
            else
            {
                SetPlayerPos(playerid, 2065.4656,-1831.3871,13.3786);
                TogglePlayerControllable(playerid, 0);
                SetTimerEx("PNSfreeze", 5000, false, "i", playerid);
                GivePlayerMoney(playerid,-3500);
                return 1;
            }
	    }
	}
	return 1;
}


forward PNSfreeze(playerid);
public PNSfreeze(playerid)
{
    TogglePlayerControllable(playerid, 1);
    SetVehiclePos(playerid, 2105.3506,-1775.3052,13.3918);
    return 1;
}
Reply
#2

Try debugging your script with print and printf, it's likely that will help finding the cause. Also, note that 7.0 in IsPlayerInRangeOfPoint actually not that far is, it's only 7 meters. It's barely two vehicles away from the center of the Pay&Spray.

Also note that you're sending the playerid in the timer, but then you're using SetVehiclePos with the playerid? I can guess that that will move the incorrect vehicle (or move no vehicle at all).
Reply
#3

Okay, but the 7 meters , it has to be like that, i have a pickup there that shows where you have to be. Still could someone do it, i didnt quite understand.
Reply
#4

Anyone?
Reply
#5

Have you tried debugging it with print and printf etc?
Reply
#6

The command makes zero sense. Especially this part:
Код:
if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehiclePos(playerid, 2065.4656,-1831.3871,13.3786);
            }
            else
            {
                SetPlayerPos(playerid, 2065.4656,-1831.3871,13.3786);
                TogglePlayerControllable(playerid, 0);
                SetTimerEx("PNSfreeze", 5000, false, "i", playerid);
                GivePlayerMoney(playerid,-3500);
                return 1;
            }
Do you even understand what the condition performs here? Why'd you move a player in the PNS if he's not in any vehicle? That's exactly what your condition does, moves the vehicle if the player is in any, if he's not, it moves him, freezes him and whatever else you wrote there. Fix that and it should work.
Reply
#7

yea, i saw that mistake and fixed it, il try again,
Reply
#8

got it fixed, removed that and added a few things.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)