[Help]OnPlayerStateChange
#1

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
 	if(GetPlayerPos(playerid,-1563.1354,1267.6215,1.6521) == true);
 	GameTextForPlayer(playerid, "Test BlaBla", 5000, 3);
	return 1;
}
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/buyalpha", cmdtext, true, 10) == 0)
	{
		if(GetPlayerPos(playerid,-1970.5682,197.4940,27.0591) == true)
 		AddStaticVehicle(490,-1970.3485,203.4463,27.1131,90.3389,0,0); //
 		SetPlayerPos(playerid,-1973.5952,189.1256,27.6148);
		return 1;
	}
	
  	return 0;
}
It says a Error Arguments Dismatch


Reply
#2

GetPlayerPos under OnPlayerStateChange? O_o

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerPos(playerid,-1563.1354,1267.6215,1.6521))
        GameTextForPlayer(playerid, "Test BlaBla", 5000, 3);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buyalpha", cmdtext, true, 10) == 0)
    {
        if(GetPlayerPos(playerid,-1970.5682,197.4940,27.0591))
        {
            AddStaticVehicle(490,-1970.3485,203.4463,27.1131,90.3389,0,0);
            SetPlayerPos(playerid,-1973.5952,189.1256,27.6148);
            return 1;
        }
    }
   
    return 0;
}
But I recommend you use PlayerToPoint instead of GetPlayerPos, though.
Reply
#3

Why you using GetPlayerPos, you will have to be EXACTLY in that position.
Use PlayerToPoint..
Reply
#4

Well I think I have done a Mistake....

Ok Here is How I want it to be I have a Placed Info Icon at the XYZ now if I go near that Info Icon I want to DisPlay a Message " /rentalpha " So and I only Want that command to work only at the Same Place and we can't use it when we are not there...

So the Player In-Game does like this...

A Player says a Info Icon and in the Screen it shows up to /rentcar then he does it and More Commands like /rentalpha,/rentphoniex,/rentsentitial and so on...And then if he does /rentalpha his Position is Changed a Bit and a Car Spawns in front of it...

I want the Command /rentcar and /rentalpha... to be done only if he is in that Info Icon if he is not there a Message Spits out that you are not in the Car Renting Area.


Now how should I do?
Reply
#5

You will need a repeating timer checking if he's near that position. When he gets near it, send the message. In your command to create the vehicle or whatever do another check for if they are near the point.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)