05.04.2008, 04:07
Hey, I must first say that my english understanding is not always good, especially when it comes to advanced english wich I found in the pawn.pdf so I have not continued to read it.
However, I was looking at some gamemode scripts earlier where they had drugs and drug smuggling in their gamemode and I am not here to ask how to make it, I will rather find out on my own. I am here to see if I could do it a better way then what I currently have done!
Here is my script, it compiles 100% and my two commands work ingame, I can get drugs and see the drugs.
First of, I used the same way I saw a guy use for wanted system (if you kill a person you gain +wanted stars each kill) and I thought, Maybe use the same for my drugs script!
But here is my concern, script below makes my script look so messy because I repeat same script piece over and over again just to get one result.
Can I make this easier instead of constantly adding if(drugs[playerid] == X) ? How can I make a line that just lookup what value i have instead of asking if I have 1,2,3,4 and so on?
Also I would like to know if it is stupid to use the script I am using? Should I make it diffrent,easier to understand? Could it make my gamemode lag or get bugged because I use this or that code?
I hope you understand, this is not matter of searching on the forum for help, I ask for guidance so I do not make a very very long script that maybe end up very buggy or laggy for my gamemode. Or can I continue using the codes I have been using.
However, I was looking at some gamemode scripts earlier where they had drugs and drug smuggling in their gamemode and I am not here to ask how to make it, I will rather find out on my own. I am here to see if I could do it a better way then what I currently have done!
Here is my script, it compiles 100% and my two commands work ingame, I can get drugs and see the drugs.
Код:
new Drugs[MAX_PLAYERS];
Код:
if (strcmp(cmdtext, "/getdrugs", true)==0) { new oldlevel; new newlevel; oldlevel = Drugs[playerid]; newlevel = oldlevel + 1; Drugs[playerid] = newlevel; SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have been given 1G drugs!"); return 1; }
Can I make this easier instead of constantly adding if(drugs[playerid] == X) ? How can I make a line that just lookup what value i have instead of asking if I have 1,2,3,4 and so on?
Код:
// ============================================= // if (strcmp(cmdtext, "/drugs", true)==0) { if(gJob[playerid] == JOB_CIVILIAN) { if(Drugs[playerid] == 0) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have no drugs on you!"); } else if(Drugs[playerid] == 1) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have 1g drugs on you!"); } else if(Drugs[playerid] == 2) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have 2g drugs on you!"); } } return 1; } // ============================================= //
Also I would like to know if it is stupid to use the script I am using? Should I make it diffrent,easier to understand? Could it make my gamemode lag or get bugged because I use this or that code?
I hope you understand, this is not matter of searching on the forum for help, I ask for guidance so I do not make a very very long script that maybe end up very buggy or laggy for my gamemode. Or can I continue using the codes I have been using.