Why it sends the message 4 times not just 1 ?
#1

Command:
PHP код:
else if(!strcmp(option"cocaine"true4))
            {
                if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /twithdraw cocaine [amount]");
                if(
PlayerInfo[playerid][pvTcocaine] < amount) return SendClientMessage(playeridCOLOR_GREY"You don't have that much cocaine in your trunk.");
                
PlayerInfo[playerid][pvTcocaine] -= amount;
                
PlayerInfo[playerid][pcocaine] += amount;
                    
format(stringsizeof(string), "* %s opens their trunk and takes %d grams of cocaine from it."RPN(playerid), amount);
                
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            } 
It sends *Steve opens their trunk and takes 15 grams of cocaine from it. 4 times, but why it sends the message 4 times ?
Reply
#2

Show entire command.
Reply
#3

Try this maybe

PHP код:
else if(!strcmp(option"cocaine"true1)) 
            { 
                if(
sscanf(params"s[32]i"optionamount)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /twithdraw cocaine [amount]"); 
                if(
PlayerInfo[playerid][pvTcocaine] < amount) return SendClientMessage(playeridCOLOR_GREY"You don't have that much cocaine in your trunk."); 
                
PlayerInfo[playerid][pvTcocaine] -= amount
                
PlayerInfo[playerid][pcocaine] += amount
                    
format(stringsizeof(string), "* %s opens their trunk and takes %d grams of cocaine from it."RPN(playerid), amount); 
                
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE); 
            } 
Reply
#4

We need to see the whole command.
Also this function could be causing problems so it could be usefull to see it as well:

pawn Код:
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
regards, wolf.
Reply
#5

Its not cause of this function, i am using it for all my commands and they work fine, dunno what is going on with this one this is the logic of pawno
Reply
#6

Why are you repeating COLOR_PURPLE so many times?
Reply
#7

Because its my function, and this question is not related to the problem
Reply
#8

Perhaps you can show us your SendNearbyMessage?

Or maybe what are you doing before executing this at first place?

Quote:
Originally Posted by SandKing94
Посмотреть сообщение
Because its my function, and this question is not related to the problem
I can't solve you a problem without knowing what's the code is.
Reply
#9

PHP код:
stock SendNearbyMessage(playeridFloat:radiusstring[], col1col2col3col4col5)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    new 
Float:ixFloat:iyFloat:iz;
    new 
Float:cxFloat:cyFloat:cz;
    foreach(
Playeri)
    {
        if(
IsPlayerLoggedIn(i))
        {
            if(
GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
            {
                
GetPlayerPos(iixiyiz);
                
cx = (ix);
                
cy = (iy);
                
cz = (iz);
                if(((
cx radius/16) && (cx > -radius/16)) && ((cy radius/16) && (cy > -radius/16)) && ((cz radius/16) && (cz > -radius/16)))
                {
                    
SendClientMessage(icol1string);
                }
                else if(((
cx radius/8) && (cx > -radius/8)) && ((cy radius/8) && (cy > -radius/8)) && ((cz radius/8) && (cz > -radius/8)))
                {
                    
SendClientMessage(icol2string);
                }
                else if(((
cx radius/4) && (cx > -radius/4)) && ((cy radius/4) && (cy > -radius/4)) && ((cz radius/4) && (cz > -radius/4)))
                {
                    
SendClientMessage(icol3string);
                }
                else if(((
cx radius/2) && (cx > -radius/2)) && ((cy radius/2) && (cy > -radius/2)) && ((cz radius/2) && (cz > -radius/2)))
                {
                    
SendClientMessage(icol4string);
                }
                else if(((
cx radius) && (cx > -radius)) && ((cy radius) && (cy > -radius)) && ((cz radius) && (cz > -radius)))
                {
                    
SendClientMessage(icol5string);
                }
            }
        }
    }
    return 
1;

my stock
Reply
#10

Edit:I fixed it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)