SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 28/02/2013, 08:04 PM   #1
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Need help with PNS command!

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:

Code:
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;
}
__________________
Hade. is offline   Reply With Quote
Old 28/02/2013, 10:36 PM   #2
Basssiiie
Gangsta
 
Basssiiie's Avatar
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 758
Reputation: 191
Default Re: Need help with PNS command!

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).
Basssiiie is offline   Reply With Quote
Old 01/03/2013, 11:07 AM   #3
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Re: Need help with PNS command!

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.
__________________
Hade. is offline   Reply With Quote
Old 01/03/2013, 03:06 PM   #4
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Re: Need help with PNS command!

Anyone?
__________________
Hade. is offline   Reply With Quote
Old 01/03/2013, 03:40 PM   #5
Basssiiie
Gangsta
 
Basssiiie's Avatar
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 758
Reputation: 191
Default Re: Need help with PNS command!

Have you tried debugging it with print and printf etc?
Basssiiie is offline   Reply With Quote
Old 01/03/2013, 03:46 PM   #6
Mmartin
Banned
 
Join Date: Jan 2010
Location: Slovakia
Posts: 106
Reputation: 67
Default Re: Need help with PNS command!

The command makes zero sense. Especially this part:
Code:
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.
Mmartin is offline   Reply With Quote
Old 01/03/2013, 04:05 PM   #7
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Re: Need help with PNS command!

yea, i saw that mistake and fixed it, il try again,
__________________
Hade. is offline   Reply With Quote
Old 01/03/2013, 04:26 PM   #8
Hade.
Huge Clucker
 
Hade.'s Avatar
 
Join Date: Oct 2012
Location: Tallinn, Estonia
Posts: 210
Reputation: 16
Default Re: Need help with PNS command!

got it fixed, removed that and added a few things.
__________________
Hade. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with command. Only returns Server: Unknown Command Knappen Scripting Help 9 18/12/2013 07:09 PM
[Command Bugged] Each time i use /respawnallcars it says Unknown Command Rand_Omar Scripting Help 11 30/09/2012 01:35 AM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 04:38 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 06:19 AM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 02:34 PM


All times are GMT. The time now is 07:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.