[HELP] Dialog Script
#1

I need help with the following script, I keep getting the following error.

Код:
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(83) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(89) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(95) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(98) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(98) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
This is the script:

Код:
public OnDialogResponse(playerid,  dialogid, response, listitem, inputtext[])
{
	 if(dialogid==1 && response == 1)
	 {
	 	switch(listitem)
	   {
	     case 0:
		 {
			  GivePlayerWeapon(playerid, 24, 0x7FFFFFFF);
			  GetPlayerMoney(playerid, 6750);
			  return 1;
		 }
		 case 1:
		 {
                          GivePlayerWeapon(playerid, 31, 0x7FFFFFFF);
                          GetPlayerMoney(playerid, 15000);
                          return 1;
		 }
		 case 2:
		 {
			  GivePlayerWeapon(playerid, 27, 0x7FFFFFFF);
			  GetPlayerMoney(playerid, 20000);
			  return 1;
		 }
		 return 1;
	 }
	 return 1;
}
Please help me out on how to fix it.
Reply
#2

Bump, really need this fixed ASAP!
Reply
#3

Quote:
Originally Posted by Rose69
Посмотреть сообщение
I need help with the following script, I keep getting the following error.

Код:
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(83) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(89) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(95) : warning 202: number of arguments does not match definition
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(98) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\dw_000\Desktop\Scripting SAMP\gamemodes\renscript.pwn(98) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
This is the script:

Код:
public OnDialogResponse(playerid,  dialogid, response, listitem, inputtext[])
{
	 if(dialogid==1 && response == 1)
	 {
	 	switch(listitem)
	   {
	     case 0:
		 {
			  GivePlayerWeapon(playerid, 24, 0x7FFFFFFF);
			  GetPlayerMoney(playerid, 6750);
			  return 1;
		 }
		 case 1:
		 {
                          GivePlayerWeapon(playerid, 31, 0x7FFFFFFF);
                          GetPlayerMoney(playerid, 15000);
                          return 1;
		 }
		 case 2:
		 {
			  GivePlayerWeapon(playerid, 27, 0x7FFFFFFF);
			  GetPlayerMoney(playerid, 20000);
			  return 1;
		 }
		 return 1;
	 }
	 return 1;
}
Please help me out on how to fix it.
pawn Код:
GivePlayerWeapon(playerid, 27, 0x7FFFFFFF);
GivePlayerWeapon(playerid, 24, 0x7FFFFFFF);
GivePlayerWeapon(playerid, 31, 0x7FFFFFFF);
what is this trying to mean?

the correct definition is
pawn Код:
GivePlayerWeapon(playerid, weaponid, ammo);
Example:
pawn Код:
GivePlayerWeapon(playerid, 26, 64); // Give playerid a sawn-off shotgun with 64 ammo
and:
pawn Код:
GetPlayerMoney(playerid, 20000);
GetPlayerMoney(playerid, 15000);
GetPlayerMoney(playerid, 6750);
it should be:
pawn Код:
GivePlayerMoney(playerid, 6750);
GivePlayerMoney(playerid, 15000);
GivePlayerMoney(playerid, 20000);
and you placed return 1; in a wrong place and you didnt return OnDialogResponse as a value

and dialogid == 1? I dont think its possible to make that as a dialogid but ok

try this code:

pawn Код:
public OnDialogResponse(playerid,  dialogid, response, listitem, inputtext[])
{
    if(dialogid==1 && response == 1)
    {
        switch(listitem)
        {
            case 0:
            {
                GivePlayerWeapon(playerid, 24, 500);
                GivePlayerMoney(playerid, 6750);
                return 1;
            }
            case 1:
            {
                GivePlayerWeapon(playerid, 31, 500);
                GivePlayerMoney(playerid, 15000);
                return 1;
            }
            case 2:
            {
                GivePlayerWeapon(playerid, 27, 500);
                GivePlayerMoney(playerid, 20000);
                return 1;
            }
        }
        return 1;
    }
    return 0;
}
Reply
#4

This isnt any number of ammo for starter 0x7FFFFFFF
And GetPlayerMoney(playerid); only checks the player money and does not have a second argument.
To take money simply do GivePlayerMoney(playerid, -ammount);

Quote:
Originally Posted by TheFlyer
Посмотреть сообщение
pawn Код:
GivePlayerWeapon(playerid, 27, 0x7FFFFFFF);
GivePlayerWeapon(playerid, 24, 0x7FFFFFFF);
GivePlayerWeapon(playerid, 31, 0x7FFFFFFF);
what is this trying to mean?

the correct definition is
pawn Код:
GivePlayerWeapon(playerid, weaponid, ammo);
Example:
pawn Код:
GivePlayerWeapon(playerid, 26, 64); // Give playerid a sawn-off shotgun with 64 ammo
and:
pawn Код:
GetPlayerMoney(playerid, 20000);
GetPlayerMoney(playerid, 15000);
GetPlayerMoney(playerid, 6750);
it should be:
pawn Код:
GivePlayerMoney(playerid, 6750);
GivePlayerMoney(playerid, 15000);
GivePlayerMoney(playerid, 20000);
and you placed return 1; in a wrong place and you didnt return OnDialogResponse as a value

and dialogid == 1? I dont think its possible to make that as a dialogid but ok

try this code:

pawn Код:
public OnDialogResponse(playerid,  dialogid, response, listitem, inputtext[])
{
    if(dialogid==1 && response == 1)
    {
        switch(listitem)
        {
            case 0:
            {
                GivePlayerWeapon(playerid, 24, 500);
                GivePlayerMoney(playerid, 6750);
                return 1;
            }
            case 1:
            {
                GivePlayerWeapon(playerid, 31, 500);
                GivePlayerMoney(playerid, 15000);
                return 1;
            }
            case 2:
            {
                GivePlayerWeapon(playerid, 27, 500);
                GivePlayerMoney(playerid, 20000);
                return 1;
            }
        }
        return 1;
    }
    return 0;
}
That will GIVE the player money. He wants to take..
Reply
#5

Here this will take the money away from them.
PHP код:
public OnDialogResponse(playerid,  dialogidresponselistiteminputtext[])
{
    if(
dialogid==&& response == 1)
    {
        switch(
listitem)
        {
            case 
0:
            {
                
GivePlayerWeapon(playerid24500);
                
GivePlayerMoney(playerid, -6750);
                return 
1;
            }
            case 
1:
            {
                
GivePlayerWeapon(playerid31500);
                
GivePlayerMoney(playerid, -15000);
                return 
1;
            }
            case 
2:
            {
                
GivePlayerWeapon(playerid27500);
                
GivePlayerMoney(playerid, -20000);
                return 
1;
            }
        }
        return 
1;
    }
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)