Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #define PLUGIN "Graffiti"
- #define VERSION "1.0"
- #define AUTHOR "Ark'xes"
- new bool:graffitiCooldown[33];
- new UserGraffiti[64][33];
- new GraffitiBox[33];
- new SelectedGraffiti[33];
- new cvar_RemoveGraffiti;
- new cvar_GraffitiCD;
- public plugin_precache()
- {
- precache_model("models/csgo_graffit.mdl");
- }
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd("say /graff", "GraffitiMenu")
- register_impulse(201, "Graffiti");
- register_cvar("go_removegraffiti", 4115128, MaxClients, MaxClients);
- register_cvar("go_graffiticd", "30.0", MaxClients, MaxClients);
- public client_impulse(id, impulse)
- {
- if (impulse == 201)
- {
- return 1;
- }
- return 0;
- }
- public removeGraffiti()
- {
- new ent = -1;
- while ((ent = find_ent_by_class(ent, "GraffitiEntity")))
- {
- remove_entity(ent);
- }
- return 0;
- }
- public removeEntity(id)
- {
- new ent = -1;
- while ((ent = find_ent_by_owner(ent, "ThinkingEntity", id, MaxClients)))
- {
- remove_entity(ent);
- }
- return 0;
- }
- public Graffiti(id)
- {
- new ent = create_entity("info_target");
- new Float:fAimOrigin[3] = 0.0;
- new Float:fPlayerOrigin[3] = 0.0;
- new Float:fAimVector[3] = 0.0;
- new Float:fNormalVector[3] = 0.0;
- new Float:fTextVector[3] = 0.0;
- new Float:fraction = 0.0;
- pev(id, 126, fAimVector);
- angle_vector(fAimVector, 1, fAimVector);
- pev(id, 118, fPlayerOrigin);
- fAimVector[0] = floatadd(floatmul(1176255488, fAimVector[0]), fPlayerOrigin[0]);
- fAimVector[1] = floatadd(floatmul(1176255488, fAimVector[1]), fPlayerOrigin[1]);
- fAimVector[2] = floatadd(1148846080, floatadd(floatmul(1176255488, fAimVector[2]), fPlayerOrigin[2]));
- new iTr = create_tr2();
- engfunc(29, fPlayerOrigin, fAimVector, 1, id, iTr);
- get_tr2(iTr, 5, fAimOrigin);
- get_tr2(iTr, 7, fNormalVector);
- get_tr2(iTr, NULL_STRING, fraction);
- free_tr2(iTr);
- new Float:mins[3] = {1.1776383E-38,8.167E-42,5.767E-41};
- new Float:maxs[3] = {7.987E-42,7.987E-42,5.7491E-41};
- new var1;
- if (fraction <= 0.01 && !graffitiCooldown[id])
- {
- if (SelectedGraffiti[id])
- {
- new Float:cooldown = get_pcvar_float(cvar_GraffitiCD);
- client_cmd(id, "spk %s", g_szSoundFileSpray);
- graffitiCooldown[id] = 1;
- set_task(cooldown, "RemoveCooldown", id, 4109032, MaxClients, 4109036, MaxClients);
- vector_to_angle(fNormalVector, fTextVector);
- entity_set_vector(ent, 6, fTextVector);
- entity_set_model(ent, "models/csgo_graffit.mdl");
- entity_set_size(ent, mins, maxs);
- entity_set_origin(ent, fAimOrigin);
- set_pev(ent, 133, 4122940);
- entity_set_int(ent, 14, MaxClients);
- entity_set_edict(ent, NULL_STRING, id);
- entity_set_string(ent, MaxClients, "GraffitiEntity");
- entity_set_int(ent, 15, MaxClients);
- set_pev(ent, 71, SelectedGraffiti[id] - 1);
- }
- client_print(id, NULL_STRING, "%L", id, "NO_GRAFFITI");
- }
- return 0;
- }
- public RemoveCooldown(id)
- {
- graffitiCooldown[id] = 0;
- return 0;
- }
- public GraffitiMenu(id)
- {
- new szText[256];
- new String[32];
- formatex(szText, 256, "%L %L", id, "PREFIX_HUD", id, "MENU_GRAFFITI");
- new menu = menu_create(szText, "graffiti_handler", MaxClients);
- formatex(szText, 256, "%L\n\r------------------------", id, "OPEN_GRAFFITI", GraffitiBox[id]);
- menu_additem(menu, szText, "-1", MaxClients, -1);
- new i = 1;
- while (i < 64)
- {
- if (0 < UserGraffiti[i][id])
- {
- new var1;
- if (i == SelectedGraffiti[id])
- {
- var1 = 4141404;
- }
- else
- {
- var1 = 4141452;
- }
- formatex(szText, 256, "%s \w[\r%d\w] %L", Graffities[i], UserGraffiti[i][id], id, var1);
- formatex(String, 32, "%d", i);
- menu_additem(menu, szText, String, MaxClients, -1);
- }
- i++;
- }
- menu_setprop(menu, 6, 1);
- menu_display(id, menu, MaxClients, -1);
- return 1;
- }
- public graffiti_handler(id, menu, item)
- {
- if (item == -3)
- {
- MainMenu(id);
- menu_destroy(menu);
- return 1;
- }
- new data[9];
- new name[64];
- new Key;
- new access;
- new callback;
- menu_item_getinfo(menu, item, access, data, NULL_VECTOR, name, 63, callback);
- Key = str_to_num(data);
- if (Key == -1)
- {
- if (0 < GraffitiBox[id])
- {
- new rNum = random_num(1, 63);
- client_print_color(id, MaxClients, "%L %L", id, "PREFIX_CHAT", id, "OPENED_GBOX", Graffities[rNum]);
- UserGraffiti[rNum][id]++;
- GraffitiBox[id]--;
- }
- GraffitiMenu(id);
- UpdateMisc(id);
- return 1;
- }
- if (Key == SelectedGraffiti[id])
- {
- SelectedGraffiti[id] = 0;
- }
- else
- {
- SelectedGraffiti[id] = Key;
- }
- GraffitiMenu(id);
- UpdateMisc(id);
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement