Jump to content

Is this Script Correct?


t3hf4ll0ut

Recommended Posts

Okay, so I kinda got bored today and had nothing to do so I just started writing random scripts. I want to try something when I get home, but to save time I want to make sure this script works before I get home.

 

scn 10mmLoadingScript

;Defining Objectives

int GunCheck

;Taking gun from player and placing it on table

Begin OnActivate player
set GunCheck to player.GetItemCount Weap10mmPistol == 1
If GunCheck == 1
Then player.RemoveItem Weap10mmPistol
elseif GunCheck == 0
Then ShowMessage 01NoWeap
endif
end

Edited by t3hf4ll0ut
Link to comment
Share on other sites

Just a couple things:

 

Don't use numbers as the first character of an object. Use your initials or aa, etc. Also,

 

On Activate Player

 

Doesn't do anything, even though it compiles. If you want to check who activated something, you have to use IsActionRef

 

You can simplify the script a little. You don't need the short. Note that if the player has more than 1 pistol the message will still show and nothing will happen to the weapon count.

 

 

scn aa10mmLoadingScript 

;Defining Objectives 

;Taking gun from player and placing it on table 

Begin OnActivate

if IsActionRef Player == 1
 if (player.GetItemCount Weap10mmPistol == 1 )
  player.RemoveItem Weap10mmPistol 1
       else
  ShowMessage aa01NoWeap
 endif
endif

end

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...