/checkvehicles command
#1

Hello everybody, May I seek some of your help please. I am very lost.

I am trying to make a command to show the admin how many vehicles spawned by that specific admin, and not see the other vehicles that other admins spawned:

pawn Код:
enum gPInfo
{
    vehicles,
};

new PInfo[MAX_PLAYERS][gPInfo]

enum gVInfo
{
    model,
    vehid,
    admin,
};

new VInfo[MAX_PLAYERS][MAX_VEHICLES][gVInfo];
pawn Код:
dcmd_checkv(playerid,params[])
{
    #pragma unused params
    if(PInfo[playerid][AdminLevel] == 0) return SendClientMessage(playerid, COLOUR_RED, "Sorry, but you are not an admin");
    new str[128], str1[128];
    format(str, sizeof(str), "|-_ Vehicles Spawned: %d _-|", PInfo[playerid][vehicles]);
    SendClientMessage(playerid, COLOUR_BLUE, str);
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        format(str1, sizeof(str1), "Vehicle Model: %s | ID: %d", VehicleNames[VInfo[playerid][i][model] - 400], VInfo[playerid][i][vehid]);
        SendClientMessage(playerid, COLOUR_WHITE, str1);
        return 1;
    }
    return 1;
}
My /v command
pawn Код:
dcmd_v(playerid,params[])
{
              //the other part of the script

              new car;
    new LVehicleID;
    new Float:X,Float:Y,Float:Z;
    new Float:Angle,int1;
    GetPlayerPos(playerid, X,Y,Z);
    GetPlayerFacingAngle(playerid,Angle);
    int1 = GetPlayerInterior(playerid);
    LVehicleID = CreateVehicle(car, X,Y,Z+1, Angle, colour1, colour2, -1);
    LinkVehicleToInterior(LVehicleID,int1);
    PutPlayerInVehicle(playerid, LVehicleID, 0);
    format(str1, sizeof(str1), "|- You have Spawned A %s(%d) With Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
    SendClientMessage(playerid, COLOUR_GOLD, str1);

    VInfo[playerid][PInfo[playerid][vehicles]][model] = car;
    VInfo[playerid][PInfo[playerid][vehicles]][vehid] = GetPlayerVehicleID(playerid);
    PInfo[playerid][vehicles] ++;
    return 1;
}
/checkv shows the number of vehicles that I spawned. However, the problem that I am having now is that it only shows the first vehicle that I spawned, and not any of the subsequent vehicles. Is there a way to SendClientMessage the same number of times as the number of vehicles spawned, such that the script shows me the number of vehicles spawned and details of each individual.
Thanks in advance.
Reply
#2

pawn Код:
dcmd_v(playerid,params[])
{
              //the other part of the script

         new car;
    new LVehicleID;
    new Float:X,Float:Y,Float:Z;
    new Float:Angle,int1;
    GetPlayerPos(playerid, X,Y,Z);
    GetPlayerFacingAngle(playerid,Angle);
    int1 = GetPlayerInterior(playerid);
    LVehicleID = CreateVehicle(car, X,Y,Z+1, Angle, colour1, colour2, -1);
    LinkVehicleToInterior(LVehicleID,int1);
    PutPlayerInVehicle(playerid, LVehicleID, 0);
    format(str1, sizeof(str1), "|- You have Spawned A %s(%d) With Colours: %d,%d -|", VehicleNames[car-400], car, colour1, colour2);
    SendClientMessage(playerid, COLOUR_GOLD, str1);

        PInfo[playerid][vehicles] ++;
    VInfo[playerid][PInfo[playerid][vehicles]][model] = car;
    VInfo[playerid][PInfo[playerid][vehicles]][vehid] = GetPlayerVehicleID(playerid);
    return 1;
}
Reply
#3

I tried it out, but it still does not work. It still shows me the first vehicle that I spawned and cannot show me rest. Someone please help me?
Reply
#4

Код:
dcmd_checkv(playerid,params[])
{
	#pragma unused params
	if(PInfo[playerid][AdminLevel] == 0) return SendClientMessage(playerid, COLOUR_RED, "Sorry, but you are not an admin");
	new str[128], str1[128];
	format(str, sizeof(str), "|-_ Vehicles Spawned: %d _-|", PInfo[playerid][vehicles]);
	SendClientMessage(playerid, COLOUR_BLUE, str);
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		format(str1, sizeof(str1), "Vehicle Model: %s | ID: %d", VehicleNames[VInfo[playerid][i][model] - 400], VInfo[playerid][i][vehid]);
		SendClientMessage(playerid, COLOUR_WHITE, str1);
	}
	return 1;
}
^ should work
Reply
#5

Ahhhh yes It works now Thanks everyone for your help ^.^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)