SA-MP Forums Archive
Need some help with a weaponcheck timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need some help with a weaponcheck timer (/showthread.php?tid=96694)



Need some help with a weaponcheck timer - Striker_Moe - 10.09.2009

Код:
public weaponcheck()
{
	for(new i=0; i<MAX_PLAYERS; i++)
  {
    new weaponid;
    weaponid = GetPlayerWeapon(i);
		if(weaponid == 38, weaponid == 37, weaponid == 21, weaponid == 9, weaponid == 8, weaponid == 7, weaponid == 6, weaponid == 18, weaponid == 32, weaponid == 28, weaponid == 36, weaponid== 40);
		{
		  new name[MAX_PLAYER_NAME], string[128];
  		GetPlayerName(playerid, name, sizeof(name));
  		format(string, sizeof(string), ":: ADM-WARNING: %s is a potential weapon hacker :: ", name );
  		SendClientMessageToAdmins(RED, string);
  		return 1;
		}

	}
  return 0;
}
Whats wrong in here? And how can I add the playerґs ID to the adm-warning?

Errors:

C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(3293) : error 036: empty statement
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(3296) : error 017: undefined symbol "playerid"
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(34) : error 001: expected token: ";", but found "enum"



Re: Need some help with a weaponcheck timer - Striker_Moe - 10.09.2009

Anyone?


Re: Need some help with a weaponcheck timer - Calgon - 10.09.2009

Use "||" in the if statement, instead of the commas. Also, where you've added "playerid", replace it with "i".

Use this code instead, it will be more efficient and beneficial for your administration:

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
{
new weapon[128], string[128];
switch(GetPlayerWeapon(i))
{
case 38, 37, 21, 9, 8, 7, 6, 18, 32, 28, 36, 40:
{
format(string, sizeof(string), "WARNING: %s has obtained a potentially hacked weapon (%s).", name, weapon);
SendClientMessageToAdmins(RED, string);
}
}
}
You'll have to sort the indentation out, though.


Re: Need some help with a weaponcheck timer - Striker_Moe - 10.09.2009

Can you actually replace the weapon-id with the weapon name, somehow? This is included in the script yet:
Код:
new WeapNames[][32] = {
	{"Unarmed (Fist)"}, // 0
	{"Brass Knuckles"}, // 1
	{"Golf Club"}, // 2
	{"Night Stick"}, // 3
	{"Knife"}, // 4
	{"Baseball Bat"}, // 5
	{"Shovel"}, // 6
	{"Pool Cue"}, // 7
	{"Katana"}, // 8
	{"Chainsaw"}, // 9
	{"Purple Dildo"}, // 10
	{"Big White Vibrator"}, // 11
	{"Medium White Vibrator"}, // 12
	{"Small White Vibrator"}, // 13
	{"Flowers"}, // 14
	{"Cane"}, // 15
	{"Grenade"}, // 16
	{"Teargas"}, // 17
	{"Molotov"}, // 18
	{" "}, // 19
	{" "}, // 20
	{" "}, // 21
	{"Colt 45"}, // 22
	{"Colt 45(Silenced)"}, // 23
	{"Deagle"}, // 24
	{"Normal Shotgun"}, // 25
	{"Sawnoff Shotgun"}, // 26
	{"Combat Shotgun"}, // 27
	{"Micro Uzi(Mac 10)"}, // 28
	{"SMG(MP5)"}, // 29
	{"AK47"}, // 30
	{"M4"}, // 31
	{"Tec9"}, // 32
	{"Country Rifle"}, // 33
	{"Sniper Rifle"}, // 34
	{"Rocket Launcher"}, // 35
	{"Heat-Seeking Rocket Launcher"}, // 36
	{"Flamethrower"}, // 37
	{"Minigun"}, // 38
	{"Satchel Charge"}, // 39
	{"Detonator"}, // 40
	{"Spray Can"}, // 41
	{"Fire Extinguisher"}, // 42
	{"Camera"}, // 43
	{"Night Vision Goggles"}, // 44
	{"Infrared Vision Goggles"}, // 45
	{"Parachute"}, // 46
	{"Fake Pistol"} // 47
};
EDIT: I got a error.

error 017: undefined symbol "name"


Re: Need some help with a weaponcheck timer - Striker_Moe - 10.09.2009

Anyone?


Re: Need some help with a weaponcheck timer - [eLg]Timmy - 10.09.2009

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof name);
Even tho I dont support calgons snippet, cause OnPlayerUpdate and the callback I posted in SetDisabledWeapon() topic would be alot faster/betterr.


Re: Need some help with a weaponcheck timer - Calgon - 10.09.2009

Quote:
Originally Posted by TimmehBoy
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof name);
Even tho I dont support calgons snippet, cause OnPlayerUpdate and the callback I posted in SetDisabledWeapon() topic would be alot faster/betterr.
My bad, forgot to add that.


Re: Need some help with a weaponcheck timer - Striker_Moe - 10.09.2009

C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(3096) : error 001: expected token: "{", but found "-identifier-"
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(3096) : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : error 014: invalid statement; not in switch
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(309 : warning 215: expression has no effect
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(3099) : warning 217: loose indentation

The current script looks like this:

Код:
public weaponcheck()
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
	new weapon[128], string[128];
	new name[MAX_PLAYER_NAME];
	switch(GetPlayerWeapon(i))
 	GetPlayerName(i, name, sizeof(name));
	{
		case 38, 37, 21, 9, 8, 7, 6, 18, 32, 28, 36, 40;
	{
	format(string, sizeof(string), "WARNING: %s has obtained a potentially hacked weapon (%s).", name, weapon);
	SendClientMessageToAdmins(RED, string);
	}
	}
	}
  return 0;
}



Re: Need some help with a weaponcheck timer - xuniter - 10.09.2009

To show the players id simply insert "playerid" and your done


Re: Need some help with a weaponcheck timer - [eLg]Timmy - 10.09.2009

Quote:
Originally Posted by xuniter
To show the players id simply insert "playerid" and your done
No he has to use "i" instead of playerid. Think before you post.