SA-MP Forums Archive
Weapon kill detect - 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)
+--- Thread: Weapon kill detect (/showthread.php?tid=290363)



Weapon kill detect - manchestera - 15.10.2011

Ok ive tring to create a weapons skill system what i have done the save info part but i not sure how to make the person skill increase. What i need to do is how to tell that a person has killed with a certian weapon then add 1 to the skill level each kill here is what i am using to save the score if this helps.

Код:
DeagleSkill,

PlayerInfo[playerid][DeagleSkill] = 0;//onplayer connect

PlayerInfo[playerid][DeagleSkill] = (dUserINT(PlayerName2(playerid)).("DeagleSkill"));//in the command /stats to show there level.

dUserSetINT(PlayerName2(playerid)).("DeagleSkill",PlayerInfo[playerid][DeagleSkill]);//when saving player stats
Many thanks


Re: Weapon kill detect - Stigg - 15.10.2011

https://sampwiki.blast.hk/wiki/SetPlayerSkillLevel
https://sampwiki.blast.hk/wiki/Weapon_skills


Re: Weapon kill detect - manchestera - 15.10.2011

Have you got a link for detecting what weapon they used?


Re: Weapon kill detect - Stigg - 15.10.2011

Quote:
Originally Posted by manchestera
Посмотреть сообщение
Have you got a link for detecting what weapon they used?
https://sampwiki.blast.hk/wiki/GetPlayerWeapon


Re: Weapon kill detect - manchestera - 15.10.2011

Ok had ago and i think im half way there just got a few errors could anyone tell me what tey might be.

Код:
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(938) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(938) : warning 215: expression has no effect
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(938) : error 001: expected token: ";", but found "]"
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(938) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(938) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
{
    if(GetPlayerWeapon(killerid) == 24)[killerid][DeagleSkill]++; //addone on de skill line938
    return 1;
}



Re: Weapon kill detect - manchestera - 15.10.2011

Ok im trying another method with this but it is sil failing any ideas

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
   if( reason == 24 ) // M4 weapon ID
   {
      SetPlayerSkillLevel(killerid) [DeagleSkill][killerid] + 1 );
      DeagleSkill[ killerid ] += 1;
      SendClientMessage( killerid, 0x00FF00FF, "Upgraded your Deagle skill. Keep practicing!" );
   }
   return 1;
}

C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : warning 202: number of arguments does not match definition
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : warning 202: number of arguments does not match definition
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 001: expected token: ";", but found "["
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : warning 215: expression has no effect
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 001: expected token: ";", but found "]"
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Weapon kill detect - [MG]Dimi - 15.10.2011

SetPlayerSkillLevel(killerid) [DeagleSkill][killerid] + 1 );

You cant make it like this. You want your own skill info and using SetPlayerSkillLevel you are setting Server's Player Skill level. If you want like that make it:
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
   if( 
reason == 24 // M4 weapon ID
   
{
      
SetPlayerSkillLevel(killerid,2,+1); 
      
PlayerInfo[killerid][DeagleSkill]++;
      
SendClientMessagekillerid0x00FF00FF"Upgraded your Deagle skill. Keep practicing!" );
   }
   return 
1;




Re: Weapon kill detect - manchestera - 15.10.2011

I think i must be missing something elsewhere as im still getting errors -.-

Код:
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : warning 215: expression has no effect
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 001: expected token: ";", but found ")"
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\codmw2\filterscripts\ladmin4v2.pwn(940) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.

SetPlayerSkillLevel(killerid,2,+1); //line 940