Help adding Checkpoints !!!
#1

Hey Guys i tryed making a Mission Script i get this:
Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/work", true))
    {
        SetPlayerCheckpoint(playerid, 1644.4673, -2416.9844, 13.5547, 5.0);
        }
        else
        {
        if(IsPlayerInVehicle(playerid, 519) || IsPlayerInVehicle(playerid, 592) || IsPlayerInVehicle(playerid, 577)) return SendClientMessage(playerid,0xFFFFFFFFF,"Yor Need to be In A Vehicle to Do work!");
        return 1;
}
    
public OnPlayerEnterCheckpoint(playerid)
{
    GivePlayerMoney(playerid, 10000);
    DisablePlayerCheckpoint(playerid);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/stopwork", true))
    {
       if(GetPlayerMoney(playerid) >= 1000)
       SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
       }
       else
       {
       if(GetPlayerMoney(playerid) >= 999)
       SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
       return 1;
}
When i Compile it shows error:
[code]C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(15) : warning 217: loose indentation
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(15) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(15) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(22) : warning 225: unreachable code
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(22) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(22) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pw n(37) : error 030: compound statement not closed at the end of file (started at line 24)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.[code]

Anyone can tell me whats Wrong ? And i need help about this things too:
*How can i make something like that if player get in 1 checkpoint and another should get after 1-2 seconds
*and Last how can i give player money like 10000 to 15000 !!!! It Means it should get between them and every time changed.


AND ITS A FS not GM !!

Thanks in Advance !! +1 Rep for who Helped ME !!!!
Reply
#2

1.
Код:
if(IsPlayerInVehicle(playerid, 519, 592, 577))
You can check only for one vehicle at once, use this:
Код:
if(IsPlayerInVehicle(playerid, 519) || IsPlayerInVehicle(playerid, 592) || IsPlayerInVehicle(playerid, 577))
https://sampwiki.blast.hk/wiki/IsPlayerInVehicle
Also, the second parameter is for vehicleid, not for vehiclemodelid, for this you should use
https://sampwiki.blast.hk/wiki/GetVehicleModel
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID

2. Change OnPlayerEnterCheckpoint with OnPlayerEnterCheckPoint
3. Use https://sampwiki.blast.hk/wiki/GetTickCount, look at examples.
4. Use random, this should work: random( 5000 ) + 10000
Reply
#3

pawn Код:
if(IsPlayerInVehicle(playerid, 519, 592, 577)) return SendClientMessage(playerid,0xFFFFFFFFF,"Yor Need to be In A Vehicle to Do work!");
Here is the problem, check this:

https://sampwiki.blast.hk/wiki/Function:IsPlayerInVehicle
Reply
#4

Now i did :
Код:
#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/work", true))
    {
        SetPlayerCheckpoint(playerid, 1644.4673, -2416.9844, 13.5547, 5.0);
        }
        else
        {
        if(IsPlayerInVehicle(playerid, 519) || IsPlayerInVehicle(playerid, 592) || IsPlayerInVehicle(playerid, 577)) return SendClientMessage(playerid,0xFFFFFFFFF,"Yor Need to be In A Vehicle to Do work!");
        return 1;
}
    
public OnPlayerEnterCheckpoint(playerid)
{
    GivePlayerMoney(playerid, 10000);
    DisablePlayerCheckpoint(playerid);
    return 1;
}
But still getting errors
Reply
#5

Use this:
Код:
#include <a_samp>

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
	if( strcmp( cmdtext, "/work", true ) == 0 )
	{
		if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
				return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );

		SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 5.0 );
		return 1;
	}
	return 1;
}

public OnPlayerEnterCheckpoint( playerid )
{
	GivePlayerMoney( playerid, 10000 );
	DisablePlayerCheckpoint( playerid );
	return 1;
}
Learn some scripting first ... and ident your script to see where you forget a bracket.
Reply
#6

my script:
Код:
#include <a_samp>

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
	if( strcmp( cmdtext, "/work", true ) == 0 )
	{
		if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
				return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );

		SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 5.0 );
		return 1;
	}
	return 1;
}

public OnPlayerEnterCheckpoint( playerid )
{
	GivePlayerMoney( playerid, 10000 );
	DisablePlayerCheckpoint( playerid );
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/stopwork", true))
    {
       if(GetPlayerMoney(playerid) >= 1000)
       SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
       }
       else
       {
       if(GetPlayerMoney(playerid) >= 999)
       SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
       return 1;
}
Errors:
Код:
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pwn(26) : error 021: symbol already defined: "OnPlayerCommandText"
C:\Documents and Settings\User\Desktop\server\filterscripts\work.pwn(40) : error 030: compound statement not closed at the end of file (started at line 27)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

and i typed /work in game nothing happened !!!!
Reply
#8

Quote:
Originally Posted by Avi57
Посмотреть сообщение
and i typed /work in game nothing happened !!!!
1: You used OnPlayerCommandText twice.
2: You didn't closed a bracket.
3: Use a variable to check if a player have a job.
4: Return 0 at OnPlayerCommandText (at end) in every FS and GM !

Correct script (without variable, you make that)
Код:
#include <a_samp>

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
	if( strcmp( cmdtext, "/work", true ) == 0 )
	{
		if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
				return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );

		SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 5.0 );
		return 1;
	}
	
	if( strcmp( cmdtext, "/stopwork", true ) == 0 )
	{
		if(GetPlayerMoney(playerid) >= 1000)
		{
			DisablePlayerCheckpoint( playerid );
			SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
		}
		else
		{
			SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
		}
		return 1;
	}
	return 0;
}

public OnPlayerEnterCheckpoint( playerid )
{
	GivePlayerMoney( playerid, 10000 );
	DisablePlayerCheckpoint( playerid );
	return 1;
}
Look on other scripts to learn more, you even don't know how to close a bracket in correct place.
Reply
#9

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
1: You used OnPlayerCommandText twice.
2: You didn't closed a bracket.
3: Use a variable to check if a player have a job.
4: Return 0 at OnPlayerCommandText (at end) in every FS and GM !

Correct script (without variable, you make that)
Код:
#include <a_samp>

public OnPlayerCommandText( playerid, cmdtext[ ] )
{
	if( strcmp( cmdtext, "/work", true ) == 0 )
	{
		if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
			GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
				return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );

		SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 5.0 );
		return 1;
	}
	
	if( strcmp( cmdtext, "/stopwork", true ) == 0 )
	{
		if(GetPlayerMoney(playerid) >= 1000)
		{
			DisablePlayerCheckpoint( playerid );
			SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
		}
		else
		{
			SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
		}
		return 1;
	}
	return 0;
}

public OnPlayerEnterCheckpoint( playerid )
{
	GivePlayerMoney( playerid, 10000 );
	DisablePlayerCheckpoint( playerid );
	return 1;
}
Look on other scripts to learn more, you even don't know how to close a bracket in correct place.
i putted that and still /work is not working !!!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)