• 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.

Robd

Wow, you could have given me a chance to answer that question of yours properly. Btw, I made a road block so EHH!
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

tato

Quote from: Robd on March 23, 2011, 02:47:38 PM
public Model(vehicleid)
{
new x[256];
    if (vehicleid == 130) x = "Land Stalker";
else if (vehicleid == 131) x = "Idaho";
else if (vehicleid == 132) x = "Stinger";
else if (vehicleid == 133) x = "Line Runner";
else if (vehicleid == 134) x = "Perennial";
else if (vehicleid == 135) x = "Sentinel";
else if (vehicleid == 136) x = "Rio";
else if (vehicleid == 137) x = "Fire Truck";
else if (vehicleid == 138) x = "Trash Master";
else if (vehicleid == 139) x = "Stretch";
else if (vehicleid == 140) x = "Manana";
    else if (vehicleid == 141) x = "Infernus";
else if (vehicleid == 142) x = "Voodo";
else if (vehicleid == 143) x = "Pony";
else if (vehicleid == 144) x = "Mule";
else if (vehicleid == 145) x = "Cheetah";
else if (vehicleid == 146) x = "Ambulance";
else if (vehicleid == 147) x = "Washington";
else if (vehicleid == 148) x = "Moon Beam";
else if (vehicleid == 149) x = "Esperanto";
else if (vehicleid == 150) x = "Taxi";
    else if (vehicleid == 151) x = "Washington";
else if (vehicleid == 152) x = "Bobcat";
else if (vehicleid == 153) x = "Ice Cream";
else if (vehicleid == 154) x = "Injection";
else if (vehicleid == 155) x = "Apache";
else if (vehicleid == 156) x = "Squad Car";
else if (vehicleid == 157) x = "Enforcer";
else if (vehicleid == 158) x = "Armored Car";
else if (vehicleid == 159) x = "Banshee";
else if (vehicleid == 160) x = "Coast Guard";
    else if (vehicleid == 161) x = "Bus";
else if (vehicleid == 162) x = "Tank";
else if (vehicleid == 163) x = "Baracks";
else if (vehicleid == 164) x = "Hermes";
else if (vehicleid == 165) x = "Police Maverick";
else if (vehicleid == 166) x = "Angel";
else if (vehicleid == 167) x = "Public Bus";
else if (vehicleid == 168) x = "Taxi";
else if (vehicleid == 169) x = "Stallion";
else if (vehicleid == 170) x = "Rumpo";
    else if (vehicleid == 171) x = "Bandit";
else if (vehicleid == 172) x = "Hearse";
else if (vehicleid == 173) x = "Packer";
else if (vehicleid == 174) x = "Sentinel";
else if (vehicleid == 175) x = "Admiral";
else if (vehicleid == 176) x = "Squalo";
else if (vehicleid == 177) x = "Sparrow";
else if (vehicleid == 178) x = "Pizza";
else if (vehicleid == 179) x = "Borrito";
else if (vehicleid == 180) x = "INVALID";
    else if (vehicleid == 181) x = "INVALID";
else if (vehicleid == 182) x = "Speeder";
else if (vehicleid == 183) x = "Reefer";
else if (vehicleid == 184) x = "Tropic";
else if (vehicleid == 185) x = "INVALID";
else if (vehicleid == 186) x = "Yankee";
else if (vehicleid == 187) x = "Golf Cart";
else if (vehicleid == 188) x = "l33t cab";
else if (vehicleid == 189) x = "Top Fun";
else if (vehicleid == 190) x = "Skimmer";
    else if (vehicleid == 191) x = "PCJ";
else if (vehicleid == 192) x = "Faggio";
else if (vehicleid == 193) x = "Freeway";
else if (vehicleid == 194) x = "Baron";
else if (vehicleid == 195) x = "Raider";
else if (vehicleid == 196) x = "Glendale";
else if (vehicleid == 197) x = "Oceanic";
else if (vehicleid == 198) x = "Sanchez";
else if (vehicleid == 199) x = "Sparrow";
else if (vehicleid == 200) x = "Patriot";
else if (vehicleid == 201) x = "Limo";
else if (vehicleid == 202) x = "Coast Guard";
else if (vehicleid == 203) x = "Dinghy";
else if (vehicleid == 204) x = "Hermes";
else if (vehicleid == 205) x = "Sabre";
else if (vehicleid == 206) x = "Sabre";
else if (vehicleid == 207) x = "Phoenix";
else if (vehicleid == 208) x = "Walton";
else if (vehicleid == 209) x = "Regina";
else if (vehicleid == 210) x = "Patriot";
else if (vehicleid == 211) x = "Deluxo";
else if (vehicleid == 212) x = "Burrito";
else if (vehicleid == 213) x = "Spand";
else if (vehicleid == 214) x = "Marquis";
else if (vehicleid == 215) x = "Baggage";
else if (vehicleid == 216) x = "Taxi";
else if (vehicleid == 217) x = "Maverick";
else if (vehicleid == 218) x = "Maverick";
else if (vehicleid == 219) x = "Rancher";
else if (vehicleid == 220) x = "Rancher";
else if (vehicleid == 221) x = "Virgo";
else if (vehicleid == 222) x = "Greenwood";
else if (vehicleid == 223) x = "Jetmax";
else if (vehicleid == 224) x = "Hotring";
else if (vehicleid == 225) x = "Monster Truck";
else if (vehicleid == 226) x = "Blista";
else if (vehicleid == 227) x = "Maverick";
else if (vehicleid == 228) x = "Boxville";
else if (vehicleid == 229) x = "Benson";
else if (vehicleid == 230) x = "Jeep";
else if (vehicleid == 231) x = "Goblin";
else if (vehicleid == 232) x = "Hotring";
else if (vehicleid == 233) x = "Hotring";
else if (vehicleid == 234) x = "Bloodring";
else if (vehicleid == 235) x = "Bloodring";
else if (vehicleid == 236) x = "Cheetah";
else x = "INVALID";
return x;
}


You send this a model and it returns the car's name. To get a model you might want to make an enum like this
enum cInfo
{
model
}

new CarInfo[180][cInfo];


then if you're using pawn find "LoadVehicles"
change to
public LoadVehicles()
{
print("Loading vehicles, please wait...");
new XU;
if(!dini_Exists("/Vehicles/list.ini")) return -1;
new data[7][256];
for (XU=1; XU<=250; XU++) {
new pos[256],fm[6];
format(fm,sizeof(fm),"%d",XU);
pos = dini_Get("/Vehicles/list.ini",fm);
if (strlen(pos)) {
new id;
            split(pos,data,' ');
id = AddStaticVehicle(strval(data[0]),floatstr(data[1]),floatstr(data[2]),floatstr(data[3]),floatstr(data[4]),strval(data[5]),strval(data[6]));
//printf("Creating Vehicle! ModelID:[ %d ] Colors:[ %d ; %d ]",strval(data[0]),strval(data[5]),strval(data[6]));
CarInfo[id][model] = strval(data[0]);
}
}
printf("Vehicles Loaded!");
return asp;
}

how to use this when player gets a car or something like that?





<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

Robd

OnPlayerEnterVehicle(playerid,vehicleid)
{
   new szMsg[256];
   format(szMsg,sizeof(szMsg),"You entered a %s",Model(CarInfo[vehicleid][model]));
}
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

tato

Quote from: Robd on April 04, 2011, 04:12:00 PM
OnPlayerEnterVehicle(playerid,vehicleid)
{
   new szMsg[256];
   format(szMsg,sizeof(szMsg),"You entered a %s",Model(CarInfo[vehicleid][model]));
}

thanks i will try :D





<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

heekz.shadow

Somehow,a IsPlayerStandingStill function :D

Remember I just moved my house and im now posting it from another friends who got INTERNET.

NOT TESTED!!!glow]
UP!

#define
new PlayerCall[50];

enum NewPos

{
Float:LastX,
Float:LastY,
Float:LastZ
};

enum OldPos

{
Float:LasX,
Float:LasY,
Float:LasZ
};


new SavePlayerOldPos[MAX_PLAYERS][OldPos],SavePlayerNewPos[MAX_PLAYERS][NewPos];

UP!
forward IsPlayerStandingStill(playerid);


public IsPlayerStandingStill(playerid)
{
new Float:Lx,Float:Ly,Float:Lz;
GetPlayerPos(playerid,Lx,Ly,Lz);
SavePlayerOldPos[playerid][LasX] = Lx;
SavePlayerOldPos[playerid][LasY] = Ly;
SavePlayerOldPos[playerid][LasZ] = Lz;
GetNewPos(playerid);
return 1;
}

public GetNewPos(playerid)
{
new ishemoving;
new Float:Xx,Float:Xy,Float:Xz;
GetPlayerPos(playerid,Xx,Xy,Xz);
SavePlayerNewPos[playerid][LastX] = Xx;
SavePlayerNewPos[playerid][LastY] = Xy;
SavePlayerNewPos[playerid][LastZ] = Xz;
new Float:resultx,Float:resulty,Float:resultz,Float:finalresult;
resultx = SavePlayerNewPos[playerid][LastX] - SavePlayerOldPos[playerid][LasX];
resulty = SavePlayerNewPos[playerid][LastY] - SavePlayerOldPos[playerid][LasY];
resultz = SavePlayerNewPos[playerid][LastZ] - SavePlayerOldPos[playerid][LasZ];
finalresult = resultx+resulty+resultz;
if(finalresult != 0) {
ishemoving = 1;
}
else if(finalresult == 0)
{
ishemoving = 0;
}
return ishemoving;
}


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

Robd

Why don't you only use one and then just use GetPlayerPos? I did that for an idle script and it works fine.
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

yazeen

Quote from: Robd on April 07, 2011, 02:55:26 AM
Why don't you only use one and then just use GetPlayerPos? I did that for an idle script and it works fine.

i Made a Auto-Kick for idling BTW It Bans the player i tested a 1000 times

Robd

Ban for idle!?!?! I can understand kick, but ban?!?!?!
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

yazeen

Quote from: Robd on April 07, 2011, 10:11:45 PM
Ban for idle!?!?! I can understand kick, but ban?!?!?!

I Used Kick(playerid) BTW its Banning the players Subnet ROFL