[Help]SendClientMessage
#1

i did the following script:

public OnPlayerPickUpPickup(playerid, pickupid)
{

if(pickupid==Cash)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==Cash1)GivePlayerMoney(playerid,7);
SendClientMessage(playerid, COLOR_GREEN,"You Found 7 Bucks");
if(pickupid==Cash2)GivePlayerMoney(playerid,;
SendClientMessage(playerid, COLOR_GREEN,"You Found 8 Bucks");
if(pickupid==Cash3)GivePlayerMoney(playerid,9);
SendClientMessage(playerid, COLOR_GREEN,"You Found 9 Bucks");
if(pickupid==Cash4)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==BriefCase)GivePlayerMoney(playerid,50 0);
SendClientMessage(playerid, COLOR_GREEN,"You Found A Briefcase which has 500$ Inside");
return 1;
}

and i have a problem,once i take one of the pickups,i get all these message at once,can anyone help me?i want to get these messages appear correctly like once i take 5 bucks i get a message:"You Found 5 Bucks" and not all these at once.
Reply
#2

Quote:
Originally Posted by Danikov
i did the following script:

public OnPlayerPickUpPickup(playerid, pickupid)
{

if(pickupid==Cash)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==Cash1)GivePlayerMoney(playerid,7);
SendClientMessage(playerid, COLOR_GREEN,"You Found 7 Bucks");
if(pickupid==Cash2)GivePlayerMoney(playerid,;
SendClientMessage(playerid, COLOR_GREEN,"You Found 8 Bucks");
if(pickupid==Cash3)GivePlayerMoney(playerid,9);
SendClientMessage(playerid, COLOR_GREEN,"You Found 9 Bucks");
if(pickupid==Cash4)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==BriefCase)GivePlayerMoney(playerid,50 0);
SendClientMessage(playerid, COLOR_GREEN,"You Found A Briefcase which has 500$ Inside");
return 1;
}

and i have a problem,once i take one of the pickups,i get all these message at once,can anyone help me?i want to get these messages appear correctly like once i take 5 bucks i get a message:"You Found 5 Bucks" and not all these at once.
Where are your brackets? You forgot them.
Reply
#3

Errrrrrrr im not realy good at scripting,im a begginer and i still dont know how to place brackets correctly ;(
Reply
#4

Quote:
Originally Posted by Danikov
i did the following script:

public OnPlayerPickUpPickup(playerid, pickupid)
{

if(pickupid==Cash)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==Cash1)GivePlayerMoney(playerid,7);
SendClientMessage(playerid, COLOR_GREEN,"You Found 7 Bucks");
if(pickupid==Cash2)GivePlayerMoney(playerid,;
SendClientMessage(playerid, COLOR_GREEN,"You Found 8 Bucks");
if(pickupid==Cash3)GivePlayerMoney(playerid,9);
SendClientMessage(playerid, COLOR_GREEN,"You Found 9 Bucks");
if(pickupid==Cash4)GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
if(pickupid==BriefCase)GivePlayerMoney(playerid,50 0);
SendClientMessage(playerid, COLOR_GREEN,"You Found A Briefcase which has 500$ Inside");
return 1;
}

and i have a problem,once i take one of the pickups,i get all these message at once,can anyone help me?i want to get these messages appear correctly like once i take 5 bucks i get a message:"You Found 5 Bucks" and not all these at once.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{

    if(pickupid==Cash)
    {
    GivePlayerMoney(playerid,5);
    SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
    } // these are brackets they define what hapends if the if is true
    return 1;
}
you need to do this to every if u got :]
Reply
#5

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{

	if(pickupid==Cash){
    GivePlayerMoney(playerid,5);
	SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
    }
	if(pickupid==Cash1){
    GivePlayerMoney(playerid,7);
	SendClientMessage(playerid, COLOR_GREEN,"You Found 7 Bucks");
    }
	if(pickupid==Cash2){
    GivePlayerMoney(playerid,8);
	SendClientMessage(playerid, COLOR_GREEN,"You Found 8 Bucks");
    }
	if(pickupid==Cash3){
    GivePlayerMoney(playerid,9);
	SendClientMessage(playerid, COLOR_GREEN,"You Found 9 Bucks");
    }
	if(pickupid==Cash4){
    GivePlayerMoney(playerid,5);
	SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
    }
	if(pickupid==BriefCase){
    GivePlayerMoney(playerid,500);
	SendClientMessage(playerid, COLOR_GREEN,"You Found A Briefcase which has 500$ Inside");
    }
	return 1;
}
this should help
Reply
#6

OH Brackets like these thx
Reply
#7

Damnit still nothing and this time i get errors,can someone make me a Bracketful script like this?
I'd realy appreciate that
Reply
#8

Quote:
Originally Posted by Danikov
Damnit still nothing and this time i get errors,can someone make me a Bracketful script like this?
I'd realy appreciate that
what errors u get?
Reply
#9

Ill do what you said to me and ill post
Reply
#10

I Did this as you posted to me:
{

if(pickupid==Cash)
{
GivePlayerMoney(playerid,5);
SendClientMessage(playerid, COLOR_GREEN,"You Found 5 Bucks");
}
return 1;
}

Here it looks abit different than in the pawno but these are the Warnings(Not Errors,Sorry):

D:\Documents and Settings\victor\Desktop\SAMP Server\pawno\test.pwn(263) : warning 217: loose indentation
D:\Documents and Settings\victor\Desktop\SAMP Server\pawno\test.pwn(267) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)