Some gate-script error
#1

Hi giys im making some toll in my mapp but get some errors on this piece:
It have to check the wantedlevel, if its higher then 4, keep the gate closed.

If not, then open gate and get -50$ (this is not working too ingame, it take the money, and gives it back)

The problems are [b]

Here the piece of code you need:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/toll", true)){
        if GetPlayerWantedLevel((playerid, => 4)){
            new wantedlevel;
            wantedlevel = GetPlayerWantedLevel(playerid);
            new tmp[64];
            format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll!", wantedlevel);
            SendClientMessage(playerid, 0xFF0000FF, tmp);
        }

    else if(IsPlayerInRangeOfPoint(playerid, 15.0, 1806.19921875, 926.7998046875, 8.3000001907349)){
            SetTimerEx("CloseGate", 7000, false, "i", playerid);
            GivePlayerMoney(playerid, -50);
            MoveObject(Gate, 1806.1999511719, 926.79998779297, 8.3000001907349, 3.0, 0.0, 359.25, 0.0);
            return SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
        }
    }
    return 0;
}
Thanks!

EDIT: I see[b] is not workin in a [pawn] = [fail]
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/toll", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 1806.19921875, 926.7998046875, 8.3000001907349)
        {
            if(GetPlayerWantedLevel(playerid) > 4)
            {
                new tmp[64];
                format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll!", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, 0xFF0000FF, tmp);
            }
            else
            {
                SetTimerEx("CloseGate", 7000, false, "i", playerid);
                GivePlayerMoney(playerid, -50);
                MoveObject(Gate, 1806.1999511719, 926.79998779297, 8.3000001907349, 3.0, 0.0, 359.25, 0.0);
                SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
            }
        }
        return 1;
    }
    return 0;
}
I believe this will work, but you need to learn how to code, you are doing things that are unnecessary, I doubt you at least understand what you even wrote in your code.
Reply
#3

Quote:
Originally Posted by EV007
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/toll", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 15.0, 1806.19921875, 926.7998046875, 8.3000001907349)
        {
            if(GetPlayerWantedLevel(playerid) > 4)
            {
                new tmp[64];
                format(tmp, sizeof(tmp), "Your current wanted level is: %i you cannot pass the toll!", GetPlayerWantedLevel(playerid));
                SendClientMessage(playerid, 0xFF0000FF, tmp);
            }
            else
            {
                SetTimerEx("CloseGate", 7000, false, "i", playerid);
                GivePlayerMoney(playerid, -50);
                MoveObject(Gate, 1806.1999511719, 926.79998779297, 8.3000001907349, 3.0, 0.0, 359.25, 0.0);
                SendClientMessage(playerid, 0x006EFFFF, "You paid toll, you are ready to go!");
            }
        }
        return 1;
    }
    return 0;
}
I believe this will work, but you need to learn how to code, you are doing things that are unnecessary, I doubt you at least understand what you even wrote in your code.
Thanks, yes I know what im writing, bu I not allways know how to do it exactly :$
But how to fix the money?
It takes the money from the player and, then it give is bacK?
Reply
#4

well change GivePlayerMoney to GivePlayerCash giveplayermoney is the client sided money system thats why it returns it because server sided rejects it
Reply
#5

Quote:
Originally Posted by NinjaChicken
Посмотреть сообщение
well change GivePlayerMoney to GivePlayerCash giveplayermoney is the client sided money system thats why it returns it because server sided rejects it
(25) : error 017: undefined symbol "GivePlayerCash"

Not working

Used it lik this:
pawn Код:
GivePlayerCash(playerid, -50);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)