Some errors
#1

Hello, may someone help me sort this mess out?

PHP Code:
CMD:buyrifle(playeridparams[])
{
if(
IsPlayerInRangeOfPoint(playerid3.0295.7310,-38.1204,1001.5156))
GivePlayerWeapon(playerid331);
GivePlayerMoney(playerid,  -400);
{
else if(
IsPlayerInRangeOfPoint(playerid3.0295.7310,-38.1204,1001.5156))
{
        
GetPlayerMoney(playerid) <400);
        
SendClientMessage(playerid0xFFFFFFAA"You don't have enough money!");

error 029: invalid expression, assumed zero
(749) : warning 215: expression has no effect
(749) : error 001: expected token: ";", but found "if"
(751) : warning 215: expression has no effect
(751) : error 001: expected token: ";", but found ")"
(751) : error 029: invalid expression, assumed zero
(751) : warning 215: expression has no effect
(754) : error 030: compound statement not closed at the end of file (started at line 749)

I feel pretty confused
Reply
#2

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GetPlayerMoney(playerid) <400);
        SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
Reply
#3

I fixed & compiled your script

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        if( GetPlayerMoney(playerid) < 400 )
            return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Devilxz97
View Post
pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GetPlayerMoney(playerid) <400);
        SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
(752) : warning 215: expression has no effect
(752) : error 001: expected token: ";", but found ")"
(752) : error 029: invalid expression, assumed zero
(752) : warning 215: expression has no effect

The
PHP Code:
GetPlayerMoney(playerid) <400); 
is problem line.
Reply
#5

Quote:
Originally Posted by Alexis1999
View Post
I fixed & compiled your script

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        if( GetPlayerMoney(playerid) < 400 )
            return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
Thanks, no errors! +rep for you.
Reply
#6

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        if(GetPlayerMoney(playerid) < 400) return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    return 1;
}
Edit: Too late XD
Reply
#7

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        if(GetPlayerMoney(playerid) < 400);
        return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
        GivePlayerMoney(playerid,  -400);
        GivePlayerWeapon(playerid, 33, 1);
    }
    return 1;
}
use this , this is simple
Reply
#8

Quote:
Originally Posted by Devilxz97
View Post
pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156))
    {
        if(GetPlayerMoney(playerid) < 400);
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
        return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
use this , this is simple
Lol. Your script doesn't work as he needs. The point is to print the message if his money is lower than 400
Reply
#9

Quote:
Originally Posted by Alexis1999
View Post
Lol. Your script doesn't work as he needs. The point is to print the message if his money is lower than 400
it was fix if you see it clearly -,-
Reply
#10

pawn Code:
CMD:buyrifle(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156));
    {
        GivePlayerWeapon(playerid, 33, 1);
        GivePlayerMoney(playerid,  -400);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 3.0, 295.7310,-38.1204,1001.5156));
    {
        if( GetPlayerMoney(playerid) < 400 );
            return SendClientMessage(playerid, 0xFFFFFFAA, "You don't have enough money!");
    }
    return 1;
}
try with this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)