[Basic] VIP System
11/4/2017, 09:06
[Basic] VIP System
new VehicleText[MAX_VEHICLES],
VehicleTxt[24][MAX_VEHICLES],
VehicleVIP[MAX_VEHICLES];
public OnGameModeInit()
{
VehicleVIP[0] = AddStaticVehicle(411, 1949.1979, 1326.4017, 9.1094, 177.3950, 0, 1);
VehicleVIP[1] = AddStaticVehicle(560, 1949.1979, 1326.4017+7, 9.1094, 177.3950, 0, 1);
VehicleVIP[2] = AddStaticVehicle(541, 1949.1979, 1326.4017-7, 9.1094, 177.3950, 0, 1);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
new vehicle = GetPlayerVehicleID(playerid);
if(dialogid == DIALOG_VIPCOLORS) {
if(response) switch(listitem) {
case 0: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0x0049FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0x0049FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0x0049FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
case 1: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF81414FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF81414FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF81414FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
case 2: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF3FF02FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF3FF02FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xF3FF02FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
case 3: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
case 4: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFAF00FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFAF00FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFAF00FF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
case 5: {
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xB700FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xB700FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xB700FFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
}
}
}
}
return 1;
}
CMD:vipname(playerid, params[]) {
new text[24], vehicle = GetPlayerVehicleID(playerid);
// if(VehicleVIP[0] != vehicle || VehicleVIP[1] != vehicle || VehicleVIP[2] != vehicle) return SCM(playerid, 0x99FF99FF, "Nu esti intrun vehicul VIP");
if(sscanf(params, "s[24]", text)) return SCM(playerid, -1, "Syntax: /vipname Text");
if(GetVehicleModel(VehicleVIP[0]) == 411 && vehicle == VehicleVIP[0]) { // Infernus
DestroyObject(VehicleText[VehicleVIP[0]]);
format(VehicleTxt[VehicleVIP[0]], 24, "%s", text);
VehicleText[VehicleVIP[0]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[0]], VehicleTxt[VehicleVIP[0]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[0]], VehicleVIP[0], -0.005000,-1.944998,0.269999,-90.000000,0.000000,0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
printf("Vehicle 1 Text: %s", VehicleTxt[VehicleVIP[0]]);
} else if(GetVehicleModel(VehicleVIP[1]) == 560 && vehicle == VehicleVIP[1]) { // Sultan
DestroyObject(VehicleText[VehicleVIP[1]]);
format(VehicleTxt[VehicleVIP[1]], 24, "%s", text);
VehicleText[VehicleVIP[1]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[1]], VehicleTxt[VehicleVIP[1]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[1]], VehicleVIP[1], -0.015000,-0.394999,0.794999,-89.000000,-1.000000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
printf("Vehicle 2 Text: %s", VehicleTxt[VehicleVIP[1]]);
} else if(GetVehicleModel(VehicleVIP[2]) == 541 && vehicle == VehicleVIP[2]) { // Bullet
DestroyObject(VehicleText[VehicleVIP[2]]);
format(VehicleTxt[VehicleVIP[2]], 24, "%s", text);
VehicleText[VehicleVIP[2]] = CreateObject(19327, 0, 0, -1000, 0, 0, 0, 100);
SetObjectMaterialText(VehicleText[VehicleVIP[2]], VehicleTxt[VehicleVIP[2]], 0, OBJECT_MATERIAL_SIZE_256x64, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
AttachObjectToVehicle(VehicleText[VehicleVIP[2]], VehicleVIP[2], -0.005000,-0.394999,0.589999,-88.500000,-1.500000,-0.500000);
SendClientMessage(playerid, -1, "Ai adaugat un text VIP");
printf("Vehicle 3 Text: %s", VehicleTxt[VehicleVIP[2]]);
}
return 1;
}
CMD:vipnamecolor(playerid, params[]) {
ShowPlayerDialog(playerid, DIALOG_VIPCOLORS, DIALOG_STYLE_LIST, "SERVER: VIP Vehicle Colors:", "Blue\nRed\nYellow\nWhite\nOrange\nViolet", "Select", "Cancel");
return 1;
}
Explicatii:
VehicleText[MAX_VEHICLES] - Aceasta variabila va crea si stoca obiectul de pe masina;
VehicleTxt[24][MAX_VEHICLES] - Aceasta variabila va stoca textul de pe masina, si se auto regenereaza cand folosim comanda /vipname;
VehicleVIP[MAX_VEHICLES] - Aceasta variabila va stoca id-ul masini vip;
Problema de la vipnamecolors este ca in ondialogresponse trebuie readaugate culorile.
new se adauga inaintea main() sau unde mai aveti variabile new in gamemode.
La ongamemodeinit se aduga VehicleVIP[0] = CreateVehicle();
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum