Why message send "Two or even three times"
#1

Hi
Any ideas why sometimes message send two or three times "You picked something"?
Код:
    if(pInfo[playerid][IsPlayerInfected] == 0)
	{
    new slot, weap, ammo;
    for ( slot = 0; slot < 14; slot++ )
    {
    GetPlayerWeaponData(playerid,slot,weap,ammo);
    if(IsValidWeapon(weap))
    {
    new randomselect = random(3); // i put random 5 because i want give a chance win nothing.
    switch(randomselect)
	{
    case 0:
	{
    new randomammo = random(15);
    GivePlayerWeapon(playerid,weap,randomammo);
	format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something");
	SendClientMessage(playerid,-1,sudasnx);
	DestroyPickup(meatDrops[playerid]);
    }
Reply
#2

Break from loop or use return to break from function its self when a match or true statement occurred.
Reply
#3

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Break from loop or use return to break from function its self when a match or true statement occurred.
Like this?
Код:
new randomammo = random(15);
    GivePlayerWeapon(playerid,weap,randomammo);
	format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something");
	SendClientMessage(playerid,-1,sudasnx);
	DestroyPickup(meatDrops[playerid]);
        break;
Reply
#4

Bump
Reply
#5

Код:
    if(pInfo[playerid][IsPlayerInfected] == 0)
	{
    new slot, weap, ammo;
    for ( slot = 0; slot < 14; slot++ )
    {
    GetPlayerWeaponData(playerid,slot,weap,ammo);
    if(IsValidWeapon(weap))
    {
    new randomselect = random(3); // i put random 5 because i want give a chance win nothing.
    switch(randomselect)
	{
    case 0:
	{
    new randomammo = random(15);
    GivePlayerWeapon(playerid,weap,randomammo);
	format(sudasnx,sizeof(sudasnx),""COL_WHITE"|: You picked something");
	SendClientMessage(playerid,-1,sudasnx);
	DestroyPickup(meatDrops[playerid]);
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)