• Welcome to Vice City Multiplayer.
 

Some usefull functions

Started by heekz.shadow, February 10, 2011, 06:47:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

heekz.shadow

Add here all your greatest functions (: .
I will start:
PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
   new Float:oldposx, Float:oldposy, Float:oldposz;
   new Float:tempposx, Float:tempposy, Float:tempposz;
   GetPlayerPos(playerid, oldposx, oldposy, oldposz);
   tempposx = (oldposx -x);
   tempposy = (oldposy -y);
   tempposz = (oldposz -z);
   if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
   {
       return 1;
   }
   return 0;
}
Not made by me
GetNick(playerid)
{
new Nick[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid)) GetPlayerName(playerid,Nick,sizeof(Nick));
else format(Nick,sizeof(Nick),"0");
return Nick;
}
Made by me
forward HowMuchPlayersAreInArea(Float:radi,Float:x,Float:y,Float:z);
public HowMuchPlayersAreInArea(Float:radi,Float:x,Float:y,Float:z)
{
new i;
new cplayers=0;
   for(i = 0; i < MAX_PLAYERS; i++)
   {
       if(PlayerToPoint(radi, i, x, y, z))
       {
       cplayers++;
}
}
return cplayers;
}
Made by me:)





Pro Scripter[/b][/i][/u]

theway

how can i uesd ?  What is the use


aXXo



//Function to get a Subnet from IP

public GetSubnet(IP[])
{
new IP1[76],IP2[76],counter=0;
IP1=strtok(IP,counter,'.');
IP2=strtok(IP,counter,'.');
new Subnet[72];
format(Subnet,sizeof(Subnet),"%s.%s",IP1,IP2);
return Subnet;
}


public FindPlayerIDFromString(string[])
{// for determining player id from a string  -bakasan
// fixed version by aXXo
new player = INACTIVE_PLAYER_ID;
new p = 0;
if ((strlen(string) <= 2) && (isnumeric(string) == 1)) {
if (IsPlayerConnected(strval(string))) return strval(string);
else return INACTIVE_PLAYER_ID;
}
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
}

shivambansal

Quote from: theway on February 11, 2011, 05:02:56 AM
how can i uesd ?  What is the use



you have your own server ???
copy these and paste in a notepad ten paste in your server' scriptsfiles

heekz.shadow

as example:
if(PlayerToPoint(Float:radi,playerid,Float:X,Float:Y,Float:Z)) {

// smthing happens
return 1;
}


Pro Scripter[/b][/i][/u]

heekz.shadow

It under-understands :)) Its simple.

as example,you wanna do /c repair

this could be the code
if(strcmp(cmdtext,"repair",true) == 0)
{
if(PlayerToPoint(30.0,playerid,somecoords)) {
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
SendClientMessage(playerid,COLOR_GREEN,"Vehicle Repaired");
}
else
{
SendClientMessage(playerid,COLOR_GREEN,"You are not at Pay'n'Spray");
}
return 1;
}


Pro Scripter[/b][/i][/u]

BIG[H]

aXXo How to Make A Subnet Ban CMD O_o
My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

Robd

#7
with the subnet function you could just make a command that adds a list of all the subnets and then compare them on player connect
This probably isnt ground breaking but here's a function for sending a message to players near another player

stock say(playerid,string[256])
{
    for(new i = 0; i <= MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) == 1) {
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
            if (GetDistance(i,X,Y,Z) <= 10) {
SendClientMessage(i,COLOR_GREEN,string);
}
}
}
return 1;
}
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

heekz.shadow

Subnets banning is simple,it uses DINI.

So when someone does /c sban his subnet gonna be typed on a file then he is kicked
when a player connects,his subnet is compared with the subnets listed on that file,if it returns 1,then he is kicked,and if returns 0,it is just fine !


Pro Scripter[/b][/i][/u]

BIG[H]

My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

heekz.shadow

Sorry,I dont got enough time and its just a prototype.


Pro Scripter[/b][/i][/u]

yazeen

shadow can u give the code for making properties pickup by typing !addprop my gups have this cmd but dont work so i deleted it can u give me the code plse 

heekz.shadow



Pro Scripter[/b][/i][/u]

BIG[H]

My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

heekz.shadow

Do someone minded at taking scripts from sa-mp and converting into vcmp ?  ::) ::) ::) ::)


Pro Scripter[/b][/i][/u]