/carsign
#1

Hello, I'm making advert system and decided to make 3DText attached to players car, what I want is when text reach 30 chars go in next column or whatever, something like this.

Selling this car for 30,000$, call 111111. - this is too long I want something like this

Selling this car for 30,000$
call 111111.

I think you get the point, here is my code, it is totally messed up because I've tried everything and nothing works properly.

pawn Код:
CMD:carad(playerid, params[])
{
    new
        vehicleid = GetPlayerVehicleID(playerid),
        string[60];
   
   
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, -1, "You're not in a vehicle.");
       
    if(isnull(params))
        return SendClientMessage(playerid, -1, "-> /carad [Advertisement text]");
       
    /*if (!PlayerInfo[playerid][pCarAdvert])
        return SendClientMessage(playerid, -1, "-> You don't have a Car Sign.");*/

       
    if(VehicleHasSign[GetPlayerVehicleID(playerid)] == 1)
        return SendClientMessage(playerid, -1, "Vehicle already has a sign.");
       
    format(string, sizeof(string), "%s\n", params);
    strcat(string, params, 30 char);
    format(string, sizeof(string), "%s", params);
    strcat(string, params, 30 char);


    vehicle3Dtext[vehicleid] = Create3DTextLabel(string, COLOR_CARAD, 0.0, 0.0, 0.0, 10.0, 0, 1);
    Attach3DTextLabelToVehicle(vehicle3Dtext[vehicleid], vehicleid, -1.0, -2.0, 0.0);
    VehicleHasSign[vehicleid] = 1;


        //PlayerInfo[playerid][pCarAdvert] = false;

    return 1;
}
Reply
#2

Try this:
Код:
if (strlen(params) > 30) format(string, sizeof(string), "%.30s\n%s", params, params[30]);
Reply
#3

I love you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)