Jump to content
AnDrEyUpS

/sfg cu dialog ca la drink dar sa iti spawneze masina setata.

Recommended Posts

Buna ziua am creeat acest topic deoarece am vrut sa imi prezentati un sistem simplu cred ca pe server-ul lui Raduq.

Adica:Eu o sa fac o arena ... si o sa pun cerc in care playerii sa tasteze comanda /sfg sau orice alta comanda si, sa-i bage intr-un dialog ca, la /buydrink inloc de bauturi sa-si aleaga o masina care sa fie spawnata...,dar sa nu le fie data de tot si prin asta ma refer la /v.

GameMode = Human

Procesor = CMD

Si ex de o comanda  sa vedeti cam ce se foloseste in gm-ul meu:

 

CMD:spawncar(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_DARKGRAY, AdminError);
    new vehicleid[25], color1 = 0, color2 = 1;
    if(sscanf(params, "s[24]dd", vehicleid, color1, color2)) return SendSyntaxMessage(playerid, "/spawncar [name/id] [color1] [color2]");
    new vehslot = GetFreeAdminVehicleSlot(), Float: pos[3];
    if(IsNumeric(vehicleid))
    {
        if(!IsValidVehicleModel(strval(vehicleid))) return SendClientMessage(playerid, COLOR_DARKGRAY, "Invalid vehicle model.");
        if(vehslot == -1) return SendClientMessage(playerid, COLOR_DARKGRAY, "The Admin Vehicle spawn limit has been reached. (100/100 Vehicles)");
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        AdminVehicleData[vehslot][a_vehicleID] = CreateVehicle(strval(vehicleid), pos[0], pos[1], pos[2], 0.0, color1, color2, -1), vVar[4][AdminVehicleData[vehslot][a_vehicleID]] = vehslot;
        vVar[1][AdminVehicleData[vehslot][a_vehicleID]] = 0, SetVehicleParamsExx(AdminVehicleData[vehslot][a_vehicleID], IsABike(AdminVehicleData[vehslot][a_vehicleID]) ? (1) : (0),0,vParams[2],0,0,0,vParams[6]);
        if(AdminVehicleData[vehslot][a_vehicleID] == INVALID_VEHICLE_ID) return AdminVehicleData[vehslot][a_vehicleID] = -1, SendClientMessage(playerid, -1, "An error has occured. The vehicle couldn't be created.");
        AdminVehicleData[vehslot][a_slotTaken] = true, AdminVehicleData[vehslot][a_spawnedBy] = playerid;
        vVar[3][AdminVehicleData[vehslot][a_vehicleID]] = GasMax, SetVehicleVirtualWorld(AdminVehicleData[vehslot][a_vehicleID], vwp[playerid]), LinkVehicleToInterior(AdminVehicleData[vehslot][a_vehicleID], innt[playerid]);
    }
    else if(!IsNumeric(vehicleid))
    {
        new modelid = GetModelIDFromName(vehicleid);
        if(modelid == -1) return SendClientMessage(playerid, COLOR_DARKGRAY, "Invalid vehicle model name.");
        if(!IsValidVehicleModel(modelid)) return SendClientMessage(playerid, COLOR_DARKGRAY, "Invalid vehicle model.");
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        if(vehslot == -1) return SendClientMessage(playerid, COLOR_DARKGRAY, "The Admin Vehicle spawn limit has been reached. (100/100 Vehicles)");
        AdminVehicleData[vehslot][a_vehicleID] = CreateVehicle(modelid, pos[0], pos[1], pos[2], 0.0, color1, color2, -1), vVar[4][AdminVehicleData[vehslot][a_vehicleID]] = vehslot;
        vVar[1][AdminVehicleData[vehslot][a_vehicleID]] = 0, SetVehicleParamsExx(AdminVehicleData[vehslot][a_vehicleID], IsABike(AdminVehicleData[vehslot][a_vehicleID]) ? (1) : (0),0,vParams[2],0,0,0,vParams[6]);
        if(AdminVehicleData[vehslot][a_vehicleID] == INVALID_VEHICLE_ID) return AdminVehicleData[vehslot][a_vehicleID] = -1, SendClientMessage(playerid, COLOR_DARKGRAY, "An error has occured. The vehicle couldn't be created.");
        AdminVehicleData[vehslot][a_slotTaken] = true, AdminVehicleData[vehslot][a_spawnedBy] = playerid;
        vVar[3][AdminVehicleData[vehslot][a_vehicleID]] = GasMax, SetVehicleVirtualWorld(AdminVehicleData[vehslot][a_vehicleID], vwp[playerid]), LinkVehicleToInterior(AdminVehicleData[vehslot][a_vehicleID], innt[playerid]);
    }
    format(AdminWText, sizeof(AdminWText), "AdmCmd: %s has spawned a vehicle (%s).", GetName(playerid), g_VehicleNames[GetVehicleModel(AdminVehicleData[vehslot][a_vehicleID])-400]);
    SendAdminMessage(playerid, COLOR_ADMWARNING, AdminWText);
    return 1;
}

 

Ma poate ajuta cineva? Dau +1

Share this post


Link to post
Share on other sites

Te poti folosi de functia CreateVehicle. Uite cum:

Faci o comanda. Spre exemplu:

CMD:spawneazamasina(playerid, params[])
{
	if(VehiculSpawnat[playerid] == 1) return SCM(playerid, -1, "Ai spawnat deja un vehicul.");
    strcat( gQuery, "Infernus\n" );
    strcat( gQuery, "Cheetah\n" );
    strcat( gQuery, "Roadtrain\r" );
    ShowPlayerDialog( playerid, Dialog_Vehicule, DIALOG_STYLE_LIST, "Vehicles", gQuery, "Alege", "Inchide" );
    return 1;
}

Apoi dialogul care e apelat de comanda.
 

case Dialog_Vehicule:
{
    switch(listitem)
	{
		case 0: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
		case 1: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
		case 2: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
	}
    return 1;
}

La onplayerconnect recomand sa setezi variabila VehiculSpawnat[playerid] = 0. O definesti la inceputul gmului asa:

new VehiculSpawnat[MAX_PLAYERS];

Sper ca te-am ajutat!

Edited by BaFFyJunior

Share this post


Link to post
Share on other sites
La 08.10.2019 la 17:36, BaFFyJunior a spus:

Te poti folosi de functia CreateVehicle. Uite cum:

Faci o comanda. Spre exemplu:


CMD:spawneazamasina(playerid, params[])
{
	if(VehiculSpawnat[playerid] == 1) return SCM(playerid, -1, "Ai spawnat deja un vehicul.");
    strcat( gQuery, "Infernus\n" );
    strcat( gQuery, "Cheetah\n" );
    strcat( gQuery, "Roadtrain\r" );
    ShowPlayerDialog( playerid, Dialog_Vehicule, DIALOG_STYLE_LIST, "Vehicles", gQuery, "Alege", "Inchide" );
    return 1;
}

Apoi dialogul care e apelat de comanda.
 


case Dialog_Vehicule:
{
    switch(listitem)
	{
		case 0: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
		case 1: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
		case 2: VehiculSpawnat[playerid] = CreateVehicle(...), PutPlayerInVehicle(playerid, VehiculSpawnat[playerid], 0);
	}
    return 1;
}

La onplayerconnect recomand sa setezi variabila VehiculSpawnat[playerid] = 0. O definesti la inceputul gmului asa:


new VehiculSpawnat[MAX_PLAYERS];

Sper ca te-am ajutat!

MS+1

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

This site uses cookies. By continuing browsing, you agree to the use of this information. For more details, see Terms of Use and Privacy Policy.