SA-MP Forums Archive
Problem ! please help me [ Gate Moving] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem ! please help me [ Gate Moving] (/showthread.php?tid=596078)



Problem ! please help me [ Gate Moving] - lordmahdi - 12.12.2015

Hi!
my code is
Код:
#define FILTERSCRIPT

#include <a_samp>

new Gate;

forward gate(playerid);

#define PRESSED(%0) \
      (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnGameModeInit()
{
    Gate = CreateObject(1491 , 233.6538, 1821.5354, 7.7601, 0.0000, 90.0000, 90.0000, 600);
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInRangeOfPoint(playerid, 1.0, -302.9852, 1511.1448, 74.3579)) return 1;
    {
       if(PRESSED(KEY_SPRINT))//Gate open
       {
           MoveObject(Gate, -313.8403, 1510.8694, 76.6647, 2.50);
           SetTimerEx("gate", 5000, false, "i", playerid);
       }
    }
    return 1;
}


public gate(playerid)
{
   MoveObject(Gate,-302.3114,1511.1448,76.6647,2.50);
   return 1;
}
public OnFilterScriptExit()
{
	return 1;
};

and errors :
Код:
D:\gtao\Call of Duty - Asia at War\gamemodes\cod8aaww.pwn(474) : error 010: invalid function or declaration
D:\gtao\Call of Duty - Asia at War\gamemodes\cod8aaww.pwn(551) : error 021: symbol already defined: "RL_OnGameModeInit"
D:\gtao\Call of Duty - Asia at War\gamemodes\cod8aaww.pwn(15149) : error 021: symbol already defined: "RL_OnPlayerKeyStateChange"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
how to fix it?


Re: Problem ! please help me [ Gate Moving] - Prajeev - 12.12.2015

Hello! I am a new scripter, I just started today and learned quite a few things.

D:\gtao\Call of Duty - Asia at War\gamemodes\cod8aaww.pwn(551) : error 021: symbol already defined: "RL_OnGameModeInit"

For this error, follow this:

Find if there's another function with RL_OnGamemodeInit and add stock before it. It'd fix the error.

For the "RL_OnPlayerKeyStateChange" error too, find the other one and add stock before it.

Ex:
Код:
stock RL_OnGamemodeInit



Re: Problem ! please help me [ Gate Moving] - lordmahdi - 12.12.2015

In this way?

Код:
stock RL_OnGamemodeInit
public OnGameModeInit()
{
.
.
.
stock RL_OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
.
.
.
errors:
Код:
D:\...\cod8aaw.pwn(549) : error 001: expected token: ";", but found "public"
D:\...\cod8aaw.pwn(550) : error 021: symbol already defined: "RL_OnGameModeInit"
D:\...\cod8aaw.pwn(15147) : error 021: symbol already defined: "RL_OnPlayerKeyStateChange"
D:\...\cod8aaw.pwn(15148) : error 021: symbol already defined: "RL_OnPlayerKeyStateChange"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Problem ! please help me [ Gate Moving] - jlalt - 12.12.2015

you already have RL_OnPlayerKeyStateChange and RL_OnGameModeInit in your script insert your codes below them instead of re make


Re: Problem ! please help me [ Gate Moving] - lordmahdi - 12.12.2015

Exuse me ! paste my code in public gamemodeinit/OnPlayerKeyStateChange or out of them ?


Re: Problem ! please help me [ Gate Moving] - jlalt - 12.12.2015

Quote:
Originally Posted by lordmahdi
Посмотреть сообщение
Exuse me ! paste my code in public gamemodeinit/OnPlayerKeyStateChange or out of them ?
search for gamemodeinit you will find one before this which you have created past them after it, you can't make two public example:

PHP код:
public OnGameModeInit() {
         print(
"Init");
}
//later down ...
public OnGameModeInit() {
        
SetGameModeText("Init");

will show me an error on second on gamemode init
symbol already defined: "OnGameModeInit"


Re: Problem ! please help me [ Gate Moving] - Prajeev - 12.12.2015

Find the other RL_OnGamemodeInit and add stock it it. You need to make it like:

Код:
stock RL_OnGamemodeInit;
Find the other RL_OnGamemodeInit and add stock it it. You need to make it like:

Код:
stock RL_OnPlayerKeyStateChange;



Re: Problem ! please help me [ Gate Moving] - Prajeev - 12.12.2015

Код:
stock RL_OnGamemodeInit
public OnGameModeInit()
{
.
.
.
stock RL_OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
.
.
.
Wrong.

Follow this.

First, go to the RL_OnPlayerKeyStateChange. Then add stock to it. It will look like:

stock RL_OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

Same with the other one.


Re: Problem ! please help me [ Gate Moving] - jlalt - 12.12.2015

Quote:
Originally Posted by Prajeev
Посмотреть сообщение
Код:
stock RL_OnGamemodeInit
public OnGameModeInit()
{
.
.
.
stock RL_OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
.
.
.
Wrong.

Follow this.

First, go to the RL_OnPlayerKeyStateChange. Then add stock to it. It will look like:

stock RL_OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

Same with the other one.
that ain't gonna fix any thing instead you will get more errors what you're trying to do its called forward not stock and it already defiend on a_samp include problem here is not this , problem is that he using same public two times he need to remove one


Re: Problem ! please help me [ Gate Moving] - Prajeev - 12.12.2015

He needs to add the stock for the another public. That's what I'm saying.