Ransom price
#1

Heey all,
I made a standard ransom price for kidnappers.
But when someone connects its turning to 10000 for every player because i putted onplayerconnect but i dont know where to place it.
Code:
Код:
//on top of script
new KidnapPrice[MAX_PLAYERS][2];
//onplayerconnect	
KidnapPrice[playerid][1]=10000;
//setprice command
if(gTeam[playerid] == TEAM_KIDNAP)
    {
		if(sscanf(params, "dd", price4))
	    {
	        SendClientMessage(playerid,COLOR_RED,"USAGE: /setprice (price)");
	        return 1;
	    }
	    if(price4 < 5000 || price4 >= 100000)
	    {
	        SendClientMessage(playerid,COLOR_RED,"You can only set the price between 5000 and 100000!");
	        return 1;
	    }

	    KidnapPrice[playerid][1] = price4;
	    format(string,sizeof(string),"You have set the ransom price to $%d",  price4);
	    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
    	return 1;
    }
Can someone have fix pls?
Thanks admigo
Reply
#2

You enlist the specifier "d" that stands for integer, but not use it?

if ( sscanf ( params, "dd", price4 ) )

Should be:

if ( sscanf ( params, "d", price4 ) )
Reply
#3

Ok but what is different between dd and d?
Reply
#4

Well, why would you put "dd" when you use only one? If you had another integer, this would be correct:

if ( sscanf ( params, "dd", price4, another_integer ) )
Reply
#5

Its not about the command,its about KidnapPrice[playerid][1]=10000;.
When i am kidnapper and i setprice it change price but if someone joins my price will be 10000.
Pls help.
Reply
#6

Debug your playerid:
pawn Код:
printf("%d",playerid);
Inside OnPlayerConnect and /ransom command.

Or search if KidnapPrice variable used in another callback/function.
Reply
#7

I know i have it in onplayerconnect so if someone connects the price will be set back to 10000.
Is it possible to add this in ongamemodeinit so its uses only one time?
Код:
KidnapPrice[playerid][1]=10000;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)