SA-MP Forums Archive
Need correction[rep] - 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: Need correction[rep] (/showthread.php?tid=316370)



Need correction[rep] - smokeweed - 06.02.2012

Can someone correct this dialog?
pawn Код:
case DIALOG_WEAPONS:
        {
            if( response )
            {
                switch( listitem )
                {
                    case 0:
                 {
    if( response )
    {
        if(GetPlayerMoney(playerid) <= 1000) || GetPlayerMoney(playerid) -1000);
        {
            echo(playerid,COLOR_DARKRED,"You have not enough money!");
        }
        else
        {
            GivePlayerWeapon(playerid, WEAPON_MP5, 50);
            echo(playerid,COLOR_BLUE,"You baught a MP5 with 50 rounds of ammo!");
        }
    }
The problem is GetPlayerMoney,

thanks


Re: Need correction[rep] - Cameltoe - 06.02.2012

pawn Код:
case DIALOG_WEAPONS:
        {
            if( response )
            {
                switch( listitem )
                {
                    case 0:
                 {
    if( response )
    {
        if(GetPlayerMoney(playerid) < 1000));
        {
            SendClientMessage(playerid,COLOR_DARKRED,"You have not enough money!");
        }
        else
        {
            GivePlayerWeapon(playerid, WEAPON_MP5, 50);
            SendClientMessage(playerid,COLOR_BLUE,"You baught a MP5 with 50 rounds of ammo!");
        }
    }



Re: Need correction[rep] - Twisted_Insane - 06.02.2012

I don't really know what's wrong, but try it with GivePlayerMoney....

PHP код:
if(GetPlayerMoney(playerid) <= 1000) || GivePlayerMoney(playerid) -1000); 
Could you explain what the exactly error is if it didn't work?


Re: Need correction[rep] - [ABK]Antonio - 06.02.2012

if(GetPlayerMoney(playerid) <= 1000) || GetPlayerMoney(playerid) -1000);

would be

if(GetPlayerMoney(playerid) <= 1000)

Then you would use GivePlayerMoney(playerid, -1000); where you gave them the weapon.


Re: Need correction[rep] - smokeweed - 06.02.2012

Weird why it is not working.. here the error list:
pawn Код:
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : error 029: invalid expression, assumed zero
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : warning 202: number of arguments does not match definition
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : warning 215: expression has no effect
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : error 001: expected token: ";", but found ")"
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : error 029: invalid expression, assumed zero
C:\Users\Nick\Desktop\Call Of Duty - Engine SA-MP\gamemodes\Untitled.pwn(357) : fatal error 107: too many error messages on one line



Re: Need correction[rep] - Twisted_Insane - 06.02.2012

Show us the line with the errors and warnings, dude!


Re: Need correction[rep] - Michael@Belgium - 06.02.2012

Why you have 2x "if(response)" ??

pawn Код:
case DIALOG_WEAPONS:
        {
            if( response )
            {
                switch( listitem )
                {
                    case 0:
                    {
                            if(GetPlayerMoney(playerid) <= 1000);
                            {
                                echo(playerid,COLOR_DARKRED,"You have not enough money!");
                            }
                            else
                            {
                                GivePlayerWeapon(playerid, WEAPON_MP5, 50);
                                echo(playerid,COLOR_BLUE,"You baught a MP5 with 50 rounds of ammo!");
                            }
                    }



Re: Need correction[rep] - smokeweed - 06.02.2012

Idk, but if response is not the problem. The problem is GetplayerMoney, I want to check if a player has 1.000 money and then I want get 1.000 from the player.

Seems like this.
pawn Код:
if GetPlayerMoney(playerid)=< 1000) || GetPlayerMoney(playerid) == -1000);



Re: Need correction[rep] - Twisted_Insane - 06.02.2012

You forgot a rounded bracket, I think, see?

Your code:

if GetPlayerMoney(playerid)=< 1000) || GetPlayerMoney(playerid) == -1000);


Try this, but I don't think that this is the error....Maybe 1 of them...

if(( GetPlayerMoney(playerid)=< 1000) || GetPlayerMoney(playerid) == -1000);


Re: Need correction[rep] - Michael@Belgium - 06.02.2012

Quote:
Originally Posted by smokeweed
Посмотреть сообщение
Idk, but if response is not the problem. The problem is GetplayerMoney, I want to check if a player has 1.000 money and then I want get 1.000 from the player.

Seems like this.
pawn Код:
if GetPlayerMoney(playerid)=< 1000) || GetPlayerMoney(playerid) == -1000);
Oooh, Try this:

pawn Код:
if(GetPlayerMoney(playerid) >= 1000)
{
SetPlayerMoney(playerid,GetPlayerMoney(playerid)-1000);
}