Raised This Month: $23 Target: $400
 5% 

Muzzleflash problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zombieboy100
New Member
Join Date: Jun 2024
Old 06-22-2024 , 08:48   Muzzleflash problem
Reply With Quote #1

Hello
It seems like the machine dont want to compile my code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fakemeta>

new g_MuzzleFlashSprite[64];
new g_ViewModelName[64];


public plugin_init() {
register_plugin("Custom Muzzle Flash", "1.0", "ZomieBoy10");

// Register weapon hooks
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "OnPrimaryAttack", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "OnPrimaryAttack", 1);
// Register other weapons similarly...

// Load the configuration file
loadConfig();
}

public loadConfig() {
new configFile[128];
formatex(configFile, sizeof(configFile) - 1, "%s/configs/custom_muzzleflash.ini", get_localinfo("amxx_datadir", "addons/amxmodx/data"));

new file = fopen(configFile, "r");
if (file) {
if (fgets(g_ViewModelName, sizeof(g_ViewModelName) - 1, file)) {
trim(g_ViewModelName);
}
if (fgets(g_MuzzleFlashSprite, sizeof(g_MuzzleFlashSprite) - 1, file)) {
trim(g_MuzzleFlashSprite);
}
fclose(file);
} else {
log_amx("Could not open custom_muzzleflash.ini");
}
}

public OnPrimaryAttack(post, id) {
if (!post) {
return HAM_IGNORED;
}

// Get the player's view model
new model[64];
pev(id, pev_viewmodel, model, sizeof(model));

// Check if the player's view model matches the specific model
if (equal(model, g_ViewModelName)) {
new Floatrigin[3];
pev(id, pev_origin, origin);

// Adjust origin to the muzzle flash position
origin[2] += 36.0; // Adjust the height to the muzzle

message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_SPRITE);
write_coord(floatround(origin[0]));
write_coord(floatround(origin[1]));
write_coord(floatround(origin[2]));
write_short(precache_model(g_MuzzleFlashSprit e));
write_byte(10); // Scale
write_byte(150); // Brightness
message_end();
}

return HAM_IGNORED;
}

public plugin_precache() {
// Precache the muzzle flash sprite
precache_model(g_MuzzleFlashSprite);
}
_____________________________________________ _______
Error: Number of arguments does not match definition on line 26
Error: Argument type mismatch (argument 1) on line 30
Error: Argument type mismatch (argument 2) on line 30
Error: Argument type mismatch (argument 1) on line 33
Error: Argument type mismatch (argument 2) on line 33

5 Errors.
Could not locate output file C:\Users\Ehsan\Desktop\muzzleflash.amx (compile failed).
Zombieboy100 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 06-22-2024 , 14:44   Re: Muzzleflash problem
Reply With Quote #2

Quote:
Originally Posted by Zombieboy100 View Post
#include <amxmodx>
Quote:
AlliedModders Forum Index > SourceMod > Scripting
You should post this question there: https://forums.alliedmods.net/forumdisplay.php?f=11

And the code must be enclosed between tags
PHP Code:
[code]your code[/code
__________________
Grey83 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode