help gate wont move
#1

hi,

i have got a command /pay then the gate should open but it dosnt.

PHP код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/pay"cmdtexttrue10) == 0)
    {
    new 
money;
    
money GetPlayerMoney(playerid);
        if(
IsPlayerInRangeOfPoint(playerid,0.0/*range*/,1105.6422,-1738.0181,13.4461))return SendClientMessage(playerid,COLOR_RED,"You are too far from the gate to pay");
        if(
money 500)return SendClientMessage(playerid,COLOR_RED,"You do not have enough money");
    
MoveObject(980,1101.724609375,-1741.2763671875,15.2739582061775.0);
    
GivePlayerMoney(playerid, -250);
    
SendClientMessage(playerid,COLOR_RED,"You have just paid and the gate is open");
        return 
1;
     }
     return 
0;

Reply
#2

Maybe the objectID isnt 980?
Change 980 in your moveobject to the ID of that object you want to move.
Reply
#3

its the id for it
iv done them normal but i cant get this one to work
Reply
#4

It does look like you're entering the model ID of the object (980) and not the actual ID of the object instance. You should make an easier way to reference to the ID of the object by storing it in a variable. For example:

pawn Код:
new gateobject;

public OnGameModeInit() // Or wherever you create those objects
{
    gateobject = CreateObject(980,0.0,0.0,0.0,0.0,0.0,0.0); // CreateObject returns the ID of the object instance, so store it in the gateobject variable.
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(strcmp(cmdtext,"/test",true) == 0)
    {
        MoveObject(gateobject,0.0,0.0,0.0,5.0); // Move the object where you want, referencing to the object ID using the value stored in the gateobject variable
        return 1;
    }
    return 0;
}
Hope that helps.
Reply
#5

how can i add this to my filter script for the hole bit
Reply
#6

Quote:
Originally Posted by Tom1412
Посмотреть сообщение
how can i add this to my filter script for the hole bit
The gate needs to be created in the same script that you have the command in, otherwise it won't really work.

Then you would literally just enter the important parts from my example into your code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)