
08-21-2005, 08:34 PM
|
|
Script-fu
|
 |
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
|
|
Quote:
|
Originally Posted by excaliber7388
this is what I have so far, I might make it set your hearts to 1 or .5 if it tuns out, instead of killing you, that way you have time to get food:
// NPC made by Excaliber
//this script makes the player say their food points. It usually would not take 1 sec to lose a point, but this was for testing, this is for offline mode right now, with toweapons I will need one for online mode
if(playerenters){client.food=100;}
//#CLIENTSIDE
if(playerenters){
client.food=100;
toweapons *Food System;}
while(isweapon){
setplayerprop #c,#v(client.food);
client.food=client.food-1;
changeimgpart 1,0,0,client.food,10;
if(client.food<1){
playerhearts=0;client.food=1}
sleep 1}
if(created){
showimg 2,drfoodbarback.png,15,115;
changeimgvis 2,4;
showimg 1,drfoodbarfp.png,37,121;
changeimgvis 1,4;}
if(playerchats&&strequals(#c,/food)){
setplayerprop #c,#v(client.food)}
|
Please, format your code. It will make it both easier to read and easier to spot syntax errors. - Because you are closing a block of code is no reason not to use ';', so don't do sleep 1 (without the ';') and close the block
- When you are only using one command as a result of an if check, you do not need to use '{' and '}', i.e. if (playerchats && strequals(#c,/food)) setplayerprop #c,#v(client.food);
- Use some spacing. if(client.food<1){ is almost harder to look at than if (client.food < 1) {
- Close blocks on a new line, don't do sleep 1;}
- Use indentation, and when posting code on the forums, surround it with [code] tags to preserve indentation
|
__________________
|
|
|
|