Loop should send one message but it sends two.
#1

Hi guys.

I have this code when the players state changes from onfoot to driver:
pawn Код:
for(new i = 0; i < sizeof(CarInfo); i++)
        {
            if(vehicleid == CarInfo[i][ownedvehicle])
            {
                new vehiclename[128];
                GetVehicleName(vehicleid, vehiclename, sizeof(vehiclename));
                format(string, sizeof(string), "* This %s is owned by %s.", vehiclename, CarInfo[i][vOwner]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            }
        }
It works in the way that it only sends the message if the vehicleid == carinfo..
But, sometimes it sends
"* This [car] is owned by [owner]"
"* This is owned by ."

I don't see why it would send it twice though, second time having empty variables.
Reply
#2

I'm prety sure your CarInfo variable length wrongly setted.
Anyways, just put a return or break.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)