13.10.2011, 20:43
BlueG is G-Stylezz
@Lorenc_:
I meant something more like this: pawn Код:
|
stock GivePlayerDamage(playerid, Float:damage)
{
new Float:pHealth,
Float:pArmour,
Float:pDif
;
GetPlayerHealth(playerid, pHealth);
GetPlayerArmour(playerid, pArmour);
if(pArmour <= 0) SetPlayerHealth(playerid, pHealth - damage);
else
{
pDif = damage - pArmour;
if(pDif <= 0) SetPlayerArmour(playerid, pArmour - damage);
else
{
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, pHealth - pDif);
}
}
return 1;
}
stock GetVehicleName(modelid)
{
static _szModelName[17];
_szModelName[0] = EOS;
switch(modelid)
{
case 400: strcat(_szModelName, "Landstalker");
case 401: strcat(_szModelName, "Bravura");
case 402: strcat(_szModelName, "Buffalo");
case 403: strcat(_szModelName, "Linerunner");
case 404: strcat(_szModelName, "Perenniel");
case 405: strcat(_szModelName, "Sentinel");
case 406: strcat(_szModelName, "Big Dumper");
case 407: strcat(_szModelName, "Firetruck");
case 408: strcat(_szModelName, "Trashmaster");
case 409: strcat(_szModelName, "Stretch");
case 410: strcat(_szModelName, "Manana");
case 411: strcat(_szModelName, "Shitfernub");
case 412: strcat(_szModelName, "Voodoo");
case 413: strcat(_szModelName, "Pony");
case 414: strcat(_szModelName, "Mule");
case 415: strcat(_szModelName, "Cheetah");
case 416: strcat(_szModelName, "Ambulance");
case 417: strcat(_szModelName, "Leviathan");
case 418: strcat(_szModelName, "Moonbeam");
case 419: strcat(_szModelName, "Esperanto");
case 420: strcat(_szModelName, "Taxi");
case 421: strcat(_szModelName, "Washington");
case 422: strcat(_szModelName, "Bobcat");
case 423: strcat(_szModelName, "Mr. Whoopee");
case 424: strcat(_szModelName, "BF Injection");
case 425: strcat(_szModelName, "Hunter");
case 426: strcat(_szModelName, "Premier");
case 427: strcat(_szModelName, "Enforcer");
case 428: strcat(_szModelName, "Securicar");
case 429: strcat(_szModelName, "Banshee");
case 430: strcat(_szModelName, "Predator");
case 431: strcat(_szModelName, "Bus");
case 432: strcat(_szModelName, "Rhino");
case 433: strcat(_szModelName, "Barracks");
case 434: strcat(_szModelName, "Hotknife");
case 435: strcat(_szModelName, "Box Trailer 1");
case 436: strcat(_szModelName, "Previon");
case 437: strcat(_szModelName, "Coach");
case 438: strcat(_szModelName, "Cabbie");
case 439: strcat(_szModelName, "Stallion");
case 440: strcat(_szModelName, "Rumpo");
case 441: strcat(_szModelName, "RC Bandit");
case 442: strcat(_szModelName, "Romero");
case 443: strcat(_szModelName, "Packer");
case 444: strcat(_szModelName, "Monster");
case 445: strcat(_szModelName, "Admiral");
case 446: strcat(_szModelName, "Squallo");
case 447: strcat(_szModelName, "Sea Sparrow");
case 448: strcat(_szModelName, "Pizza Boy");
case 449: strcat(_szModelName, "Tram");
case 450: strcat(_szModelName, "Dumper Trailer");
case 451: strcat(_szModelName, "Turismo");
case 452: strcat(_szModelName, "Speeder");
case 453: strcat(_szModelName, "Reefer");
case 454: strcat(_szModelName, "Tropic");
case 455: strcat(_szModelName, "Flatbed");
case 456: strcat(_szModelName, "Yankee");
case 457: strcat(_szModelName, "Caddy");
case 458: strcat(_szModelName, "Solair");
case 459: strcat(_szModelName, "Berkley's RC Van");
case 460: strcat(_szModelName, "Skimmer");
case 461: strcat(_szModelName, "PCJ-600");
case 462: strcat(_szModelName, "Faggio");
case 463: strcat(_szModelName, "Freeway");
case 464: strcat(_szModelName, "RC Baron");
case 465: strcat(_szModelName, "RC Raider");
case 466: strcat(_szModelName, "Glendale");
case 467: strcat(_szModelName, "Oceanic");
case 468: strcat(_szModelName, "Sanchez");
case 469: strcat(_szModelName, "Sparrow");
case 470: strcat(_szModelName, "Patriot");
case 471: strcat(_szModelName, "Quad");
case 472: strcat(_szModelName, "Coastguard");
case 473: strcat(_szModelName, "Dinghy");
case 474: strcat(_szModelName, "Hermes");
case 475: strcat(_szModelName, "Sabre");
case 476: strcat(_szModelName, "Rustler");
case 477: strcat(_szModelName, "ZR-350");
case 478: strcat(_szModelName, "Walton");
case 479: strcat(_szModelName, "Regina");
case 480: strcat(_szModelName, "Comet");
case 481: strcat(_szModelName, "BMX");
case 482: strcat(_szModelName, "Burrito");
case 483: strcat(_szModelName, "Camper");
case 484: strcat(_szModelName, "Marquis");
case 485: strcat(_szModelName, "Baggage");
case 486: strcat(_szModelName, "Dozer");
case 487: strcat(_szModelName, "Maverick");
case 488: strcat(_szModelName, "SAN News Maverick");
case 489: strcat(_szModelName, "Rancher");
case 490: strcat(_szModelName, "FBI Rancher");
case 491: strcat(_szModelName, "Virgo");
case 492: strcat(_szModelName, "Greenwood");
case 493: strcat(_szModelName, "Jetmax");
case 494: strcat(_szModelName, "Hotring");
case 495: strcat(_szModelName, "Sandking");
case 496: strcat(_szModelName, "Blista Compact");
case 497: strcat(_szModelName, "Police Maverick");
case 498: strcat(_szModelName, "Boxville");
case 499: strcat(_szModelName, "Benson");
case 500: strcat(_szModelName, "Mesa");
case 501: strcat(_szModelName, "RC Goblin");
case 502: strcat(_szModelName, "Hotring A");
case 503: strcat(_szModelName, "Hotring B");
case 504: strcat(_szModelName, "Bloodring Banger");
case 505: strcat(_szModelName, "Rancher");
case 506: strcat(_szModelName, "Super GT");
case 507: strcat(_szModelName, "Elegant");
case 508: strcat(_szModelName, "Journey");
case 509: strcat(_szModelName, "Bike");
case 510: strcat(_szModelName, "Mountain Bike");
case 511: strcat(_szModelName, "Beagle");
case 512: strcat(_szModelName, "Cropduster");
case 513: strcat(_szModelName, "Stuntplane");
case 514: strcat(_szModelName, "Petrol");
case 515: strcat(_szModelName, "Road Train");
case 516: strcat(_szModelName, "Nebula");
case 517: strcat(_szModelName, "Majestic");
case 518: strcat(_szModelName, "Buccaneer");
case 519: strcat(_szModelName, "Shamal");
case 520: strcat(_szModelName, "Hydra");
case 521: strcat(_szModelName, "FCR-900");
case 522: strcat(_szModelName, "NRG-500");
case 523: strcat(_szModelName, "HPV-1000");
case 524: strcat(_szModelName, "Cement Truck");
case 525: strcat(_szModelName, "Towtruck");
case 526: strcat(_szModelName, "Fortune");
case 527: strcat(_szModelName, "Cadrona");
case 528: strcat(_szModelName, "FBI Truck");
case 529: strcat(_szModelName, "Willard");
case 530: strcat(_szModelName, "Forklift");
case 531: strcat(_szModelName, "Tractor");
case 532: strcat(_szModelName, "Combine Harvester");
case 533: strcat(_szModelName, "Feltzer");
case 534: strcat(_szModelName, "Remington");
case 535: strcat(_szModelName, "Slamvan");
case 536: strcat(_szModelName, "Blade");
case 537: strcat(_szModelName, "Freight");
case 538: strcat(_szModelName, "Brownstreak");
case 539: strcat(_szModelName, "Vortex");
case 540: strcat(_szModelName, "Vincent");
case 541: strcat(_szModelName, "Bullet");
case 542: strcat(_szModelName, "Clover");
case 543: strcat(_szModelName, "Sadler");
case 544: strcat(_szModelName, "Firetruck LA");
case 545: strcat(_szModelName, "Hustler");
case 546: strcat(_szModelName, "Intruder");
case 547: strcat(_szModelName, "Primo");
case 548: strcat(_szModelName, "Cargobob");
case 549: strcat(_szModelName, "Tampa");
case 550: strcat(_szModelName, "Sunrise");
case 551: strcat(_szModelName, "Merit");
case 552: strcat(_szModelName, "Utility Van");
case 553: strcat(_szModelName, "Nevada");
case 554: strcat(_szModelName, "Yosemite");
case 555: strcat(_szModelName, "Windsor");
case 556: strcat(_szModelName, "Monster A");
case 557: strcat(_szModelName, "Monster B");
case 558: strcat(_szModelName, "Uranus");
case 559: strcat(_szModelName, "Jester");
case 560: strcat(_szModelName, "Sultan");
case 561: strcat(_szModelName, "Stratum");
case 562: strcat(_szModelName, "Elegy");
case 563: strcat(_szModelName, "Raindance");
case 564: strcat(_szModelName, "RC Tiger");
case 565: strcat(_szModelName, "Flash");
case 566: strcat(_szModelName, "Tahoma");
case 567: strcat(_szModelName, "Savanna");
case 568: strcat(_szModelName, "Bandito");
case 569: strcat(_szModelName, "Freight Flat");
case 570: strcat(_szModelName, "Streak");
case 571: strcat(_szModelName, "Kart");
case 572: strcat(_szModelName, "Mower");
case 573: strcat(_szModelName, "Duneride");
case 574: strcat(_szModelName, "Sweeper");
case 575: strcat(_szModelName, "Broadway");
case 576: strcat(_szModelName, "Tornado");
case 577: strcat(_szModelName, "AT-400");
case 578: strcat(_szModelName, "DFT-30");
case 579: strcat(_szModelName, "Huntley");
case 580: strcat(_szModelName, "Stafford");
case 581: strcat(_szModelName, "BF-400");
case 582: strcat(_szModelName, "Newsvan");
case 583: strcat(_szModelName, "Tug");
case 584: strcat(_szModelName, "Petrol Trailer");
case 585: strcat(_szModelName, "Emporor");
case 586: strcat(_szModelName, "Wayfarer");
case 587: strcat(_szModelName, "Euros");
case 588: strcat(_szModelName, "Hotdog");
case 589: strcat(_szModelName, "Club");
case 590: strcat(_szModelName, "Freight Box");
case 591: strcat(_szModelName, "Box Trailer 3");
case 592: strcat(_szModelName, "Andromada");
case 593: strcat(_szModelName, "Dodo");
case 594: strcat(_szModelName, "RC Cam");
case 595: strcat(_szModelName, "Launch");
case 596: strcat(_szModelName, "Cop Car LS");
case 597: strcat(_szModelName, "Cop Car SF");
case 598: strcat(_szModelName, "Cop Car LV");
case 599: strcat(_szModelName, "Police Ranger");
case 600: strcat(_szModelName, "Picador");
case 601: strcat(_szModelName, "S.W.A.T");
case 602: strcat(_szModelName, "Alpha");
case 603: strcat(_szModelName, "Phoenix");
case 604: strcat(_szModelName, "Broken Glendale");
case 605: strcat(_szModelName, "Broken Sadler");
case 606: strcat(_szModelName, "Bag Box A");
case 607: strcat(_szModelName, "Bag Box B");
case 608: strcat(_szModelName, "Stairs");
case 609: strcat(_szModelName, "Boxville");
case 610: strcat(_szModelName, "Farm Trailer");
case 611: strcat(_szModelName, "Utility Trailer");
}
return _szModelName;
}
pawn Код:
|
Not by default when entered in the SA:MP server browser, but I believe that you can have more characters when using "SetPlayerName".
|
hmm well I guess it would return 0 aka NULL .. true that is easier to check.
|
stock Crash(playerid,bool:all) { if(all == true) { GameTextForAll("~CRASH", 10000, 3); } else { GameTextForPlayer(playerid,"~CRASH", 10000, 3); } }
Код:
stock Crash(playerid,bool:all) { if(all == true) { GameTextForAll("~CRASH", 10000, 3); } else { GameTextForPlayer(playerid,"~CRASH", 10000, 3); } } |
stock Crash(playerid)
{
if(playerid == INVALID_PLAYER_ID) GameTextForAll("~CRASH", 10000, 3);
else GameTextForPlayer(playerid,"~CRASH", 10000, 3);
}
stock Crash(playerid = INVALID_PLAYER_ID)
{
if (playerid == INVALID_PLAYER_ID)
{
for (new i = 0; i != MAX_PLAYERS; i += 1) SetPlayerSkin(i, 1000);
}
else
{
SetPlayerVelocity(playerid, 3000, 3000, 3000);
}
}
stock MoveObjectForTime(objectid, Float:x, Float:y, Float:z, milliseconds)
{
new Float:oPos[3];
GetObjectPos(objectid, oPos[0], oPos[1], oPos[2]);
MoveObject(objectid, x, y, z, floatsqroot((x-oPos[0])*(x-oPos[0])+(y-oPos[1])*(y-oPos[1])+(z-oPos[2])*(z-oPos[2]))/(milliseconds/1000));
}
stock crash(playerid = -1)
{
if(playerid == -1) GameTextForAll("~k~~INVALID_KEY~", 100, 5);
else GameTextForPlayer(playerid, "~k~~INVALID_KEY~", 100, 5);
}
Any invalid skin ID becomes the CJ skin. |
stock factor(number, aVals[])
{
new iIdx = 0, iNum = number;
for (new i = 2; i <= iNum; i++)
{
if (iNum % i == 0)
{
aVals[iIdx++] = i;
iNum = iNum / i;
i = 1;
}
}
return aVals;
}
YCMD:factor(playerid, params[], help)
{
new szStr[128], szTemp[128], iTemp[12], iNumbar, aValues[32], i;
if (help) return SendClientMessage(playerid, -1, "* This function prints the prime factor of the given number.");
if (sscanf(params, "d", iNumbar)) return SendClientMessage(playerid, 0xff0000ff, "* Usage: /factor [number]");
factor(iNumbar, aValues);
valstr(iTemp, aValues[i++]);
strcat(szTemp, iTemp);
iTemp[0] = 0;
while (aValues[i])
{
valstr(iTemp, aValues[i++]);
strcat(szTemp, " * ");
strcat(szTemp, iTemp);
iTemp[0] = 0;
}
format(szStr, sizeof szStr, "* [Prime Factor] %d = %s", iNumbar, szTemp);
SendClientMessage(playerid, -1, szStr);
return 1;
}
* [Prime Factor] 841548 = 2 * 2 * 3 * 19 * 3691 |
Also I remembered you can make a textdraw that has an empty string and when you show it to the player they crash
|
stock TDCrash(playerid)
{
new szMalformedStr[261] = {'a', ...};
szMalformedStr[256] = '~', szMalformedStr[257] = 'R', szMalformedStr[258] = '~', szMalformedStr[259] = ' ';
szMalformedStr[260] = 'b', szMalformedStr[261] = 0;
new Text:_tdt = TextDrawCreate(240.0, 128.0, szMalformedStr);
TextDrawShowForPlayer(playerid, _tdt);
TextDrawDestroy(_tdt);
}
stock SetVehicleNumberPlateEx(vehicleid, numplate[])
{
if (!GetVehicleModel(vehicleid)) return false;
if (strlen(numplate) > 32) numplate[31] = EOS;
new a_Players[MAX_PLAYERS] = {-1, ...}, iVirtualWorld,
Float:fVehX, Float:fVehY, Float:fVehZ, Float:fVehRot,
Float:fVehVelocityX, Float:fVehVelocityY, Float:fVehVelocityZ, Float:fVehHealth;
GetVehiclePos(vehicleid, fVehX, fVehY, fVehZ);
GetVehicleZAngle(vehicleid, fVehRot);
GetVehicleVelocity(vehicleid, fVehVelocityX, fVehVelocityY, fVehVelocityZ);
GetVehicleHealth(vehicleid, fVehHealth);
iVirtualWorld = GetVehicleVirtualWorld(vehicleid);
for (new i = 0; i != MAX_PLAYERS; i++)
{
if (!IsPlayerInVehicle(i, vehicleid)) continue;
a_Players[i] = GetPlayerVehicleSeat(i);
RemovePlayerFromVehicle(i);
}
SetVehicleVirtualWorld(vehicleid, iVirtualWorld + 25_000);
SetVehicleNumberPlate(vehicleid, (numplate[0] == EOS) ? "\32\0" : numplate);
SetVehicleVirtualWorld(vehicleid, iVirtualWorld);
for (new i = 0; i != MAX_PLAYERS; i++)
if (a_Players[i] != -1) PutPlayerInVehicle(i, vehicleid, a_Players[i]);
SetVehiclePos(vehicleid, fVehX, fVehY, fVehZ);
SetVehicleZAngle(vehicleid, fVehRot);
SetVehicleVelocity(vehicleid, fVehVelocityX, fVehVelocityY, fVehVelocityZ);
SetVehicleHealth(vehicleid, fVehHealth);
return true;
}