SA-MP Forums Archive
[Help]SendClientMessage - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]SendClientMessage (/showthread.php?tid=102776)



[Help]SendClientMessage - Danikov - 17.10.2009

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.


Re: [Help]SendClientMessage - Eazy_Efolife - 17.10.2009

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.


Re: [Help]SendClientMessage - Danikov - 17.10.2009

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


Re: [Help]SendClientMessage - saiberfun - 17.10.2009

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 :]


Re: [Help]SendClientMessage - per~fectionist - 17.10.2009

Код:
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


Re: [Help]SendClientMessage - Danikov - 17.10.2009

OH Brackets like these thx


Re: [Help]SendClientMessage - Danikov - 17.10.2009

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


Re: [Help]SendClientMessage - saiberfun - 17.10.2009

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?


Re: [Help]SendClientMessage - Danikov - 17.10.2009

Ill do what you said to me and ill post


Re: [Help]SendClientMessage - Danikov - 17.10.2009

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.