![]() |
Voting Npc
Basically iv scripted an npc which you can vote with.
its pretty simple but i thought id share it. although it might not be such a great npc to you, to me its a milestone xD So far all it has is /vote and /unvote functionality. id like to make it have Votes: whatever in this.chat, but i cant figure out how to do that without skrewing it up. anyway enjoy the script, use it however you wish =D PHP Code:
|
Here's some problems with your script:
Solutions
Quote:
|
wow didnt realise there were so many problems with it :$
so id have to store it server side your saying? thatd be handy then if the npc server goes, it keeps its value. then i could do somthing like.. this.chat = "Votes: "@server.survey_votes; how do i store things to the server instead of to the npc? thanks for your feedback i really appriciate it. thats the only way im gonna learn, by people telling me what im doing wrong xD |
Quote:
server.survey_votes++; You can view, and edit server variables on the server-side. |
ah ok thanks for your help man.
il fix the script up xD |
Update.
Here is the latest new and improved version. Thanks fowlplay for your help. PHP Code:
|
Quote:
if (clientr.voted = 0) { should be if (clientr.voted == 0) { You also don't need to use a timeout at all. You only need to update the chat when the npc is created, and when a player votes. You can write a function called updateChat() to take care of that for you. PHP Code:
Re-factored: PHP Code:
Your code still needs to be updated to support multiple/changing the survey, and to be documented. |
ok, so return; is bad to use. gotcha.
iv updated it to use else functions. iv also added a server.yes.votes and server.no.votes so the player can write /yes or /no when i get home il post the script here and then can you see if its ok? anyway thanks for all your help man. |
I cant post the new one.
it seems the servers subscription has expired and i have no way of getting it. -Gunderak |
Why do you sign your posts? We can see that it's you saying it.
|
| All times are GMT +2. The time now is 06:19 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.