• Welcome to Vice City Multiplayer.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - stormeus

#1
Quote from: BIG[H] on April 27, 2011, 04:42:43 AM
floor or float

fix it Babe



          MessagePlayer( "The server has been online for" + floor( GetTickCount() / 60000 ) + " minutes.", player );


New hosting !


Actually, floor() is a valid function in Squirrel. It means to round down to the nearest whole number. Anyways, good job, Castagna!
#4
Script Showroom / Re: [Beta] Multimode Server (MMS)
April 26, 2011, 12:51:24 PM
Quote from: thijn on April 26, 2011, 08:21:14 AM
Now I saw the source I don't like it anymore, Just starting an other server and let the other one die for a new gamemode is silly..

Well if you want to reverse-engineer or hook the server, go ahead. This is just my implementation.
#5
mIRC/pawn Scripting / Re: How!!!
April 25, 2011, 06:18:43 PM
Quote from: Scripter on April 25, 2011, 04:28:04 PM
not works
Quote from: sseebbyy on April 25, 2011, 11:16:27 AM
not work to lock server in pawn ... i think...

at me not work
Quote from: Scripter on April 25, 2011, 09:20:50 AM
password    Any string    None    Sets a server password. NOTE, your server will APPEAR unlocked with the Windows server, leaving no obvious way for anyone to get in.
#6
Support / Re: How to kick
April 25, 2011, 06:15:57 PM
Quote from: BIG[H] on April 25, 2011, 03:37:20 PM
Troll noob

Use Common Sense .. In Script .pwn

BIG, try to actually help newbies to scripting. Don't call them trolling noobs or they won't learn.
#7
Support / Re: How to kick
April 25, 2011, 02:00:09 PM
Quote from: asad3man on April 25, 2011, 01:55:01 PM
i want to kick with reason what   i have to add

You don't have to add anything to kick with reasons.
#8
Support / Re: How to kick
April 25, 2011, 01:25:42 PM
Quote from: asad3man on April 25, 2011, 01:19:04 PM
hey i need to kick  players with reason is it without Reasonable....

If you get rid of this line:
else if (!strlen(reason)) SendClientMessage(playerid,0xFFFF00AA,"USAGE: /c kick [Nick/ID] [Reason]");

You won't need a reason to kick.
#9
Support / Re: How to kick
April 25, 2011, 12:38:23 PM
Quote from: asad3man on April 25, 2011, 11:44:57 AM
[IMG=http://img233.imageshack.us/img233/9922/25305695.png][/IMG]

Uploaded with ImageShack.us

First thing: what happened to FindPlayerIDFromString()? It looks like you completely erased it. Replace this code:
public FindPlayerIDFromString(string)
{}


With this code:

public FindPlayerIDFromString(string[])
{// for determining player id from a string  -bakasan
new player = INACTIVE_PLAYER_ID;
new p = 0;
while (p < MAX_PLAYERS)
{
if (strfind(gPlayers[p],string,true) != -1)
{
player = p;
break;
}
p++;
}
if (player == INACTIVE_PLAYER_ID) {// string didnt match so check if it can be an id
if ((strlen(string) > 2) || (isnumeric(string) == 0)) { return INACTIVE_PLAYER_ID; }
player = strval(string);// string is numeric and not more than 2 digits
}
if (!IsPlayerConnected(player)) { return INACTIVE_PLAYER_ID; }
return player;// valid id found
}


Another problem is that your code isn't in the right place. Everything between if (strcmp and Kick(plr); } should be somewhere in OnPlayerCommandText.
#10
mIRC/pawn Scripting / Re: !givecash fails
April 25, 2011, 12:33:08 PM
Quote from: Synx on April 25, 2011, 12:09:34 PM
That work now, but when i type id/nick someone's it sends cash to me no matter what.

In the beginning of your code, tmp is used for the nick/ID, and tmp2 is used for the amount. Then this gets switched in your format statement, and it says it sent $[player id] to you because you use playerid instead of plr.

format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to: [ %s ]",tmp,gPlayers[playerid]);

Replace tmp with tmp2
Replace gPlayers[playerid] with gPlayers[plr]

By the way, instead of using StrToInt, you can use the native strval() function instead.

Other than that, I can't see much else wrong with your code.
#11
mIRC/pawn Scripting / Re: !givecash fails
April 25, 2011, 09:56:03 AM
Quote from: Synx on April 24, 2011, 10:25:05 PM
Quoteelse if (strcmp(cmd, "!givecash", true) == 0) {
          new tmp2[256], plr;
      tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if (!strlen(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "USAGE: !givecash [Nick/ID] [Amount]");
      else if (GetPlayerHandCash(gPlayers[playerid]) < StrToInt(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "Error: You havent got the needed money.");
      else if (plr != INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
      else if(!IsPlayerRegistered(gPlayers[plr])) SendClientMessage(playerid, COLOR_RED, "Error: That nick is not registered!");
      else if (!IsNumeric(tmp2)) SendClientMessage(playerid,COLOR_GREEN, "Error: Invalid Amount!");
      else {
         format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to:[ %s ]",tmp,gPlayers[playerid]);
         SendClientMessage(playerid,COLOR_GREEN, szMsg);
         DecPlayerHandCash(playerid,StrToInt(tmp));
         IncPlayerHandCash(plr,StrToInt(tmp));
      }
      return 1;
      }

When I want send some one money it's say all time "invalid id" I type nick "invalid id". HELP!!!


else if (plr != INACTIVE_PLAYER_ID)

The != tells Pawn that if the ID is NOT an invalid player, that it should stop and tell them they don't have the required money.

Replace != with == so that it checks if the ID IS an invalid player.
#12
Part III
Arrays and Strings


Introduction
Arrays are like variables, except that they allow you to store more than one value in a given variable while only using one reference. Imagine a variable as a box that can hold a certain type. An array would be the equivalent of that same box divided into multiple pieces, each piece containing a piece of data. Of course, since the array box stores more information than the single variable box, it is bigger, so it uses more memory.

Array Indexes
We can use the same name to get the value of a part in the array, but we need a way to differentiate between each cell, or part, of the array. To do this, we use a zero-index in the array. Let's say we have an array that's 100 cells large. The zero-index, as you might assume, starts at zero, so our first value is myArray[0], and the 100th value is myArray[99]. The fifth value is myArray[4], so think of it as myArray[item number - 1].

Creating Arrays
Arrays are declared similarly to regular variables, except we specify how many array cells we want to use. Unlike the zero-index, when you create the array, you specify exactly how many cells you want to use, i.e. new myArray[10] for an array named myArray 10 cells long.

Using Array Cells
Once you have declared an array, you can use an array index to both store and get information stored in that cell. Right now, we can only store integers and floats in our arrays. Strings and characters will come later. Let's say we want to, like our last example, set the payrolls of each department into an array, with payrollArray[0] reserved for department 1, payrollArray[1] for department 2, etc. First, instantiate (create) a new array with new payrollArray[5];

Given that we know each department's payroll is $10,000 times the department ID, we can use our mathematical operators, a for loop, and our array. We've declared our array, so now let's create our for loop to iterate through each department, starting at 1 and ending at 5.


// Declare our new array
new payrollArray[5];

// Iterate through each department.
for(new i = 1; i < 5; i++)
{
// <code here>
}


However, this still doesn't store each department's payroll in the array. Trying to compile this will result in an array something like payrollArray is unused. Since our array starts at index 0 while our department IDs start at 1, we can subtract 1 from the department ID to get the array index that goes with it. Array indexes, as long as they're integral, are valid, so mathematical expressions can also be array indexes, like so: payrollArray[i - 1]; with i - 1 being the array index (DepartmentID - 1). If i was 1, the index would be 0, which is valid, so let's use this to our advantage.

We also know that our payroll is $10,000 times the department ID, so whatever the cell is, it will be equal to the department ID * 10000 (note that there are NO commas in numbers).


// Declare our new array.
new payrollArray[5];

// Iterate through each department.
for(new i = 1; i < 5; i++)
{
// i - 1 = DepartmentID - 1, for our zero-indexed array
payrollArray[i - 1] = i * 10000; // Department ID * 10000
}


We can now get the payroll from this array by using payrollArray[ID - 1]

Strings
A string is simply an array of characters (letters and punctuation) which, when put together, form a sentence, phrase, word, etc. Since they are arrays, they work similar to integral arrays, except each cell is one letter or punctuation mark. In addition, the last character in the string has to be a null character (\0), which tells the computer when the string ends. Strings can be as long or longer than the sentence that they hold. For example, the following sentence is 12 characters long:

I like pie.

It consists of 11 letters and punctuation marks, plus the null character at the end. myString[12] would work for it. myString[25] would work too. However, myString[11] is invalid. Each cell is going to be one letter, thus:

myString[0] = "I"
myString[1] = " "
myString[4] = "k"

Strings can also be formatted using the format() function, which will be described in further detail later. Entire strings can be created at once as well. If we want to use our "I like pie." sentence for our string, we first have to declare our new array.

new myString[12];

Instead of saving to individual cells, we can instead reference just the variable, then place the sentence inside a string, enclosed by double quotes (""). For example:

myString = "I like pie."

This will automatically include the null character at the end.
#13
mIRC/pawn Scripting / Re: !wep buy
April 24, 2011, 10:27:42 PM
Quote from: Synx on April 24, 2011, 10:15:47 PM
Quote}
   else if (strcmp(cmd, "!wep", true) == 0) {
   new wep,pmon;
       pmon = GetPlayerMoney(playerid);
   tmp = strtok(cmdtext, idx);
   if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
   else if (!strlen(tmp)) SendClientMessage(playerid, COLOR_GREEN, "USAGE: !wep [WeaponName/ID]");
   else {
      wep = FindWepIDFromString(tmp);
      SetPlayerMoney(playerid,pmon - 1000);
       if(wep != 33) SetPlayerWeapon(playerid,wep,9999999);
      else SendClientMessage(playerid,COLOR_RED,"You can't get this weapon, sorry.");
   }
       if(pmon == 0) {
          SendClientMessage(playerid,COLOR_RED,"Sorry, you can't get this weapon, weapon costs: 1000$ !");
        }

I fix this...
Quoteif(pmon == 0) {
but when player money is 0 he can still get weapons..

That's because it doesn't check if the player's money is 0 first, but checks after it tries to give the player the weapon. By the way, if a weapon costs $1,000, you should check if the player has at least $1,000, and not if they have $0.

Under else if(!strlen(tmp)), use this:

else if(pmon < 1000) SendClientMessage(playerid, COLOR_RED, "Sorry, you can't get this weapon. Weapons cost $1,000!");


And then get rid of this:

if(pmon == 0){
    SendClientMessage(playerid,COLOR_RED,"Sorry, you can't get this weapon, weapon costs: 1000$ !");
}
#14
Script Showroom / Re: [Beta] Multimode Server (MMS)
April 24, 2011, 09:48:27 PM
Quote from: Skirmant on April 24, 2011, 05:16:25 PM
Quote from: yazeen on April 24, 2011, 03:16:22 PM
Dude This Dosend Swith the gamemode while the game is running!  When Server Crashes or when we turn off the server it swithes to other gamemode! but we must re-enter the game! i Kinnda like it caz noone can crash our server if we put the both gamemode the same when someone crashes it automattically Runs again! Say Bye bye to Pawno server   Crashing Softwares. Good Work!

Don't see how this can stop "crashing software". Server goes online, crasher takes it down again by sending trash data. The only actual way you could stop crashing software is by making "mirror ports" for all servers. For example you set real and fake port in config. And master server links your fake port with the real port. In other words, master server only shows your fake port and is you are able to connect with it when the master server is online.  

It doesn't stop the server from crashing, but it can automatically restart the server if it crashes. For example, if you had only one gamemode called "mode," all you need to put in multimode.cfg is
mode

Run multi-svr, and once the server closes, it'll automatically go to the "next" mode, which is mode.


I also see my thread has been stickied. Thanks, guys. ;D
#15
Support / Re: How to kick
April 24, 2011, 09:45:35 PM
Delete where it says:

                return 1;
}