05.02.2011, 11:59
Hello any1 now wich one is best zcmd or dcmd ?
and how do i install dcmd instead of zcmd on my gm
and how do i install dcmd instead of zcmd on my gm
Код:
wich one is best zcmd or
Код:
#include <a_samp> #include <a_mysql> #include <foreach> #include <zcmd> #include <streamer> native sscanf(const data[], const format[], {Float,_}:...); native unformat(const data[], const format[], {Float,_}:...) = sscanf; /* Credits: G-Stylezzz ****** Me SA-MP Forums */ #undef MAX_PLAYERS #define MAX_PLAYERS (500) // CHANGE TO YOUR NUMBER OF SLOTS #define COLOR_PINK 0xFFC0CBFF #define COLOR_RED 0xFF0000FF #define COLOR_GREEN 0x008000FF #define COLOR_DARKBLUE 0x00008BFF #define COLOR_CADETBLUE 0x5F9EA0FF #define COLOR_LIGHTBLUE 0xADD8E6FF #define COLOR_YELLOW 0xECD400F6 #define COLOR_LIGHTGREEN 0x90EE90FF #define COLOR_PEACHPUFF 0xFFDAB9FF #define LIGHTBLUE2 0xF6BB0AA #define COLOR_GREY 0x808080FF #define COLOR_ORANGE 0xFFA500FF #define COLOR_BISQUE 0xFFE4C4FF #define COLOR_BLANCHEDALMOND 0xFFEBCDFF #define CYELLOW "{9DBD1E}" #define CORANGE "{E68C0E}" #define CBLUE "{39AACC}" #define CLGREEN "{30DB52}" #define CDGREEN "{6FA828}" #define CWHITE "{FFFFFF}" #define CREDISH "{CF0C43}" #define CRED "{FF0000}" #define CLBLUE "{55C2CF}" #define CCADET "{5F9EA0}" #define CPINK "{FC08CB}" #define CDBLUE "{1500FF}" #define CAQUA "{5CFFE9}" #define CGREY "{7D8584}" #define CMAROON "{912514}" #define CCORAL "{FF7F50}" #define CRACE "{F2DDC4}" #define CRACE2 "{2CC900}" #define CGAME1 "{E8DB20}" #define CGAME2 "{BA80BA}" #define CMINIG1 "{648832}" #define CMINIG2 "{4F927F}" // Your MySQL DB shit #define SQL_HOST "localhost" // Default is using WAMP #define SQL_USER "root" #define SQL_PASS "****" #define SQL_DB "mysql2" // Important to change this! #define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|") // Credits to ****** for this macro #if !defined FALSE stock bool:FALSE = false; #endif new u_Msg[128]; #define SendFMessage(%0,%1,%2,%3) \ do \ { \ format(u_Msg, sizeof (u_Msg), (%2), %3); \ SendClientMessage((%0), (%1), u_Msg); \ } \ while (FALSE) #define SendFMessageToAll(%0,%1,%2) \ do \ { \ format(u_Msg, sizeof(u_Msg), (%1), %2); \ SendClientMessageToAll((%0), u_Msg); \ } \ while (FALSE) #define DialogBox(%0,%1,%2,%3,%4,%5) ShowPlayerDialog( %0, %1, DIALOG_STYLE_MSGBOX, %2, %3, %4, %5 ) #define DialogInput(%0,%1,%2,%3,%4,%5) ShowPlayerDialog( %0, %1, DIALOG_STYLE_INPUT, %2, %3, %4, %5 ) #define DialogList(%0,%1,%2,%3,%4,%5) ShowPlayerDialog( %0, %1, DIALOG_STYLE_LIST, %2, %3, %4, %5 ) // Dialog IDs #define LOGIN (1) #define REGISTER (2) // Some uneeded shit #define MAPICONDISTANCE 500.0 #define TEXTLABELDISTANCE 100.0 #define PICKUPDISTANCE 100.0 // Other crap enum _PSTATS { pLayaName[24], pPassword[35], pKills, pDeaths, pMoney, pLevel, Float:pLastX, Float:pLastY, Float:pLastZ, pInt // Add more info } new PVar[MAX_PLAYERS][_PSTATS]; new Msg[128]; new RColors[] = { COLOR_GREEN, COLOR_LIGHTBLUE, COLOR_RED, COLOR_LIGHTGREEN, LIGHTBLUE2, LIGHTBLUE2 }; new VehicleNames[212][] = { "400 - Landstalker", "401 - Bravura", "402 - Buffalo", "403 - Linerunner", "404 - Pereniel", "405 - Sentinel", "406 - Dumper", "407 - Firetruck", "408 - Trashmaster", "409 - Stretch", "410 - Manana", "411 - Infernus", "412 - Voodoo", "413 - Pony", "414 - Mule", "415 - Cheetah", "416 - Ambulance", "417 - Leviathan", "418 - Moonbeam", "419 - Esperanto", "420 - Taxi", "421 - Washington", "422 - Bobcat", "423 - Mr Whoopee", "424 - BF Injection", "425 - Hunter", "426 - Premier", "427 - Enforcer", "428 - Securicar", "429 - Banshee", "430 - Predator", "431 - Bus", "432 - Rhino", "433 - Barracks", "434 - Hotknife", "435 - Trailer", "436 - Previon", "437 - Coach", "438 - Cabbie", "439 - Stallion", "440 - Rumpo", "441 - RC Bandit", "442 - Romero", "443 - Packer", "444 - Monster", "445 - Admiral", "446 - Squalo", "447 - Seasparrow", "448 - Pizzaboy", "449 - Tram", "450 - Trailer", "451 - Turismo", "452 - Speeder", "453 - Reefer", "454 - Tropic", "455 - Flatbed", "456 - Yankee", "457 - Caddy", "458 - Solair", "459 - Berkley's RC Van", "460 - Skimmer", "461 - PCJ-600", "462 - Faggio", "463 - Freeway", "464 - RC Baron", "465 - RC Raider", "466 - Glendale", "467 - Oceanic", "468 - Sanchez", "469 - Sparrow", "470 - Patriot", "471 - Quad", "472 - Coastguard", "473 - Dinghy", "474 - Hermes", "475 - Sabre", "476 - Rustler", "477 - ZR350", "478 - Walton", "479 - Regina", "480 - Comet", "481 - BMX", "482 - Burrito", "483 - Camper", "484 - Marquis", "485 - Baggage", "486 - Dozer", "487 - Maverick", "488 - News Chopper", "489 - Rancher", "490 - FBI Rancher", "491 - Virgo", "492 - Greenwood", "493 - Jetmax", "494 - Hotring", "495 - Sandking", "496 - Blista Compact", "497 - Police Maverick", "498 - Boxville", "499 - Benson", "500 - Mesa", "501 - RC Goblin", "502 - Hotring Racer", "503 - Hotring Racer", "504 - Bloodring Banger", "505 - Rancher", "506 - Super GT", "507 - Elegant", "508 - Journey", "509 - Bike", "510 - Mountain Bike", "511 - Beagle", "512 - Cropdust", "513 - Stunt", "514 - Tanker", "515 - RoadTrain", "516 - Nebula", "517 - Majestic", "518 - Buccaneer", "519 - Shamal", "520 - Hydra", "521 - FCR-900", "522 - NRG-500", "523 - HPV1000", "524 - Cement Truck", "525 - Tow Truck", "526 - Fortune", "527 - Cadrona", "528 - FBI Truck", "529 - Willard", "530 - Forklift", "531 - Tractor", "532 - Combine", "533 - Feltzer", "534 - Remington", "535 - Slamvan", "536 - Blade", "537 - Freight", "538 - Streak", "539 - Vortex", "540 - Vincent", "541 - Bullet", "542 - Clover", "543 - Sadler", "544 - Firetruck", "545 - Hustler", "546 - Intruder", "547 - Primo", "548 - Cargobob", "549 - Tampa", "550 - Sunrise", "551 - Merit", "552 - Utility", "553 - Nevada", "554 - Yosemite", "555 - Windsor", "556 - Monster", "557 - Monster", "558 - Uranus", "559 - Jester", "560 - Sultan", "561 - Stratum", "562 - Elegy", "563 - Raindance", "564 - RC Tiger", "565 - Flash", "566 - Tahoma", "567 - Savanna", "568 - Bandito", "569 - Freight", "570 - Trailer", "571 - Kart", "572 - Mower", "573 - Duneride", "574 - Sweeper", "575 - Broadway", "576 - Tornado", "577 - AT-400", "578 - DFT-30", "579 - Huntley", "580 - Stafford", "581 - BF-400", "582 - Newsvan", "583 - Tug", "584 - Trailer", "585 - Emperor", "586 - Wayfarer", "587 - Euros", "588 - Hotdog", "589 - Club", "590 - Trailer", "591 - Trailer", "592 - Andromada", "593 - Dodo", "594 - RC Cam", "595 - Launch", "596 - Police Car (LSPD)", "597 - Police Car (SFPD)", "598 - Police Car (LVPD)", "599 - Police Ranger", "600 - Picador", "601 - S.W.A.T. Van", "602 - Alpha", "603 - Phoenix", "604 - Glendale", "605 - Sadler", "606 - Luggage Trailer A", "607 - Luggage Trailer B", "608 - Stair Trailer", "609 - Boxville", "610 - Farm Plow", "611 - Utility Trailer" }; main() { } public OnGameModeInit() { mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS); mysql_debug(1); // Debugging enabled SetGameModeText("Simple MySQL System"); print("====================================================================="); AddVehiclesFromFile(); AddPickupFromFile(); AddLabelsFromFile(); AddMapIconFromFile(); print("=====================================================================\n"); return 1; } public OnGameModeExit() { DestroyAllDynamicMapIcons(); DestroyAllDynamicPickups(); DestroyAllDynamic3DTextLabels(); mysql_close(); return 1; } public OnPlayerConnect(playerid) { new lStr[70]; format(lStr, sizeof(lStr), ""#CBLUE"Player: "#CDGREEN"%s(%d) "#CBLUE"has joined the server!", pName(playerid), playerid); SendClientMessageToAll(-1, lStr); ResetPVars(playerid); InitConnection(playerid); return 1; } public OnPlayerDisconnect(playerid, reason) { new dStr[70]; format(dStr, sizeof(dStr), ""#CBLUE"Player: "#CDGREEN"%s(%d) "#CBLUE"has left the server!", pName(playerid), playerid); SendClientMessageToAll(-1, dStr); GetPlayerPos(playerid, PVar[playerid][pLastX], PVar[playerid][pLastY], PVar[playerid][pLastZ]); SavePInfo(playerid); return 1; } public OnPlayerSpawn(playerid) { if(PVar[playerid][pLastX] != 0.0 && PVar[playerid][pLastY] != 0) { SetPlayerPos(playerid, PVar[playerid][pLastX], PVar[playerid][pLastY], PVar[playerid][pLastZ]); SetPlayerInterior(playerid, PVar[playerid][pInt]); } else SetPlayerPos(playerid, -2808.0325, -1516.4255, 140.8438), SetPlayerInterior(playerid, 0); return 1; } public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, reason); if(killerid != INVALID_PLAYER_ID) { PVar[playerid][pKills] += 1; } PVar[playerid][pDeaths] += 1; return 1; } public OnPlayerText(playerid, text[]) { new cStr[128]; if(text[0] == '!' && PVar[playerid][pLevel] >= 1) // ADMIN CHAT .... ! BLABLABLA { format(cStr, sizeof(cStr), ""#CBLUE"Admin: "#CORANGE"%s(%d) "#CBLUE" - "#CDGREEN"%s", pName(playerid), playerid, text[1]); return 0; } SetPlayerChatBubble(playerid, text, COLOR_PINK, 100.0, 10000); return 1; } /*==============================================================================ADMIN CMDS ==============================================================================*/ CMD:commands(playerid, params[]) { if(PVar[playerid][pLevel] > 1) { SendClientMessage(playerid, -1, ""#CBLUE"Commands: /SetLevel - AddVehicle - AddIcon - AddPickup - Add3dLabel"#CYELLOW"[LVL 5]"); SendClientMessage(playerid, -1, ""#CBLUE"Commands: /Ban - Freezeall - Unfreezeall"#CYELLOW"[LVL 4]"); SendClientMessage(playerid, -1, ""#CBLUE"Commands: /Kick - GiveMoney"#CYELLOW"[LVL 3]"); SendClientMessage(playerid, -1, ""#CBLUE"Commands: /Freeze - Unfreeze - FakeChat - SetSkin"#CYELLOW"[LVL 2]"); } else { SendClientMessage(playerid, -1, ""#CBLUE"Commands: /PM - Fix - V"); } return 1; } CMD:setlevel(playerid, params[]) { if(PVar[playerid][pLevel] >= 5 || IsPlayerAdmin(playerid)) { new pID, Level; if(sscanf(params, "ud", pID, Level)) return SendClientMessage(playerid, COLOR_RED, "* Error: /SetLevel < Player ID > < Level >"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); if(GetPVarInt(pID, "LoggedIN") == 1) { new Year, Month, Day, Hour, Minute, Second; getdate(Year, Month, Day); gettime(Hour, Minute, Second); if(Level > 0) SendFMessage(pID, COLOR_LIGHTBLUE, "Admin: %s(%d) has set your admin level to: %d - %s", pName(playerid), playerid, Level); else SendFMessage(pID, COLOR_LIGHTBLUE, "Admin: %s(%d) has set your admin level to: %d", pName(playerid), playerid, Level); if(Level > PVar[pID][pLevel]) GameTextForPlayer(pID, "~r~P~g~r~p~o~y~m~p~o~g~t~w~e~p~d!", 4000, 0); else GameTextForPlayer(pID, "~r~Demoted", 4000, 0); SendFMessage(playerid, COLOR_LIGHTBLUE, "You Have given %s Admin level %d On '%d/%d/%d' at '%d:%d:%d'", pName(pID), Level, Day, Month, Year, Hour, Minute, Second); SendFMessageToAll(COLOR_LIGHTBLUE, "Admin: %s(%d) has given: %s(%d) admin level: %d", pName(playerid), playerid, pName(pID), pID, Level); PVar[pID][pLevel] = Level; return PlayerPlaySound(pID, 1057, 0.0, 0.0, 0.0); } else return SendClientMessage(playerid, COLOR_RED, "* That user does not have an account!"); } else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!"); } CMD:addvehicle(playerid, params[]) { if(PVar[playerid][pLevel] >= 5) { new dModel, Float:VX, Float:VY, Float:VZ, Float:VA; if(IsPlayerInAnyVehicle(playerid)) { GetPlayerPos(playerid, VX, VY, VZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), VA); dModel = GetVehicleModel(GetPlayerVehicleID(playerid)); AddVehicleToFile(VX, VY, VZ, VA, dModel); format(Msg, sizeof(Msg), "A new vehicle Has Been dynamically added. Model: (%d).", dModel); return SendClientMessage(playerid, COLOR_CADETBLUE, Msg); } else return SendClientMessage(playerid, COLOR_RED, "* You must be in a vehicle!"); } else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!"); } CMD:addicon(playerid, params[]) { if(PVar[playerid][pLevel] >= 5) { new MType, Float:MX, Float:MY, Float:MZ, MColor; if(unformat(params, "ih", MType, MColor)) return SendClientMessage(playerid, COLOR_RED,""#CRED"USAGE: "#CORANGE"/AddIcon < Icon ID > < Icon Color >"); GetPlayerPos(playerid, MX, MY, MZ); AddMapIconToFile(MX, MY, MZ, MType, MColor); CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, 100.0); format(Msg, sizeof(Msg),"A new map icon Has beed dynamically added. Model: (%d) Color: (%d).",MType, MColor); return SendClientMessage(playerid, COLOR_CADETBLUE, Msg); } else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!"); } CMD:addpickup(playerid, params[]) { if(PVar[playerid][pLevel] >= 5) { new PModel, PType, Float:PX, Float:PY, Float:PZ; if(unformat(params, "ih", PModel, PType)) return SendClientMessage(playerid, COLOR_RED,""#CRED"USAGE: "#CORANGE"/AddPickup < Pickup ID > < Spawn Type >"); GetPlayerPos(playerid, PX, PY, PZ); AddPickupToFile(PX, PY, PZ, PModel, PType); CreateDynamicPickup(PModel, PType, PX, PY, PZ, -1, -1, -1, 100.0); format(Msg, sizeof(Msg), "A New Pickup Has Been Added. Model: \"%d\" - Spawn Type: \"%d\"",PModel, PType); return SendClientMessage(playerid, COLOR_CADETBLUE, Msg); } else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!"); } CMD:add3dlabel(playerid, params[]) { if(PVar[playerid][pLevel] >= 5) { new Float:X, Float:Y, Float:Z; if(unformat(params, "s[128]",params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/Add3DLabel < Description >"); GetPlayerPos(playerid, X, Y, Z); AddLabelToFile(params, X, Y, Z); CreateDynamic3DTextLabel(params, RColors[random(sizeof(RColors))], X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0); format(Msg, sizeof(Msg), "A new 3D Text Label Has Been dynamically added. Description: \"%s\".",params); return SendClientMessage(playerid, COLOR_CADETBLUE, Msg); } else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!"); } CMD:pm(playerid, params[]) { new pID; if(sscanf(params, "us[128]", pID, params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/PM < PlayerID > < Message >"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); SendFMessage(pID, COLOR_PEACHPUFF, "PM From: %s(%d) - %s", pName(playerid), playerid, params); SendFMessage(playerid, COLOR_PEACHPUFF, "PM Sent To: %s(%d) - %s", pName(pID), pID, params); return 1; } CMD:setskin(playerid, params[]) { if(PVar[playerid][pLevel] >= 2) { new ID, Skin; if(sscanf(params, "ui", ID, Skin)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/SetSkin < PlayerID > < SkinID >"), SendClientMessage(playerid, COLOR_YELLOW, "This command will set a player's skin and it will be saved!"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); SendFMessage(ID, COLOR_CADETBLUE, "Administrator %s (%d) Has Set Your Skin To %d", pName(playerid), playerid, Skin); SendFMessage(playerid, COLOR_CADETBLUE, "You Have Set %s (%d) Skin To %d", pName(ID), ID, Skin); return SetPlayerSkin(ID, Skin); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:fakechat(playerid, params[]) { if(PVar[playerid][pLevel] >= 2) { new pID; if(sscanf(params, "us[128]", pID, params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/FakeChat < PlayerID > < Message >"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); SendPlayerMessageToAll(pID, params); return SendClientMessage(playerid, COLOR_LIGHTBLUE, "* The fake message has been sent!"); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:freeze(playerid, params[]) { if(PVar[playerid][pLevel] >= 2) { if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/Freeze < Player ID >"); if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOR_RED, "* This user is not connected!"); SendFMessage(strval(params), COLOR_LIGHTBLUE, "* Admin: %s(%d) has frozen you!", pName(playerid), playerid); SendFMessage(playerid, COLOR_LIGHTBLUE, "* You have frozen: %s(%d)!", pName(strval(params)), strval(params)); return TogglePlayerControllable(strval(params), 0); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:unfreeze(playerid, params[]) { if(PVar[playerid][pLevel] >= 2) { if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/UnFreeze < Player ID >"); if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOR_RED, "* This user is not connected!"); SendFMessage(strval(params), COLOR_LIGHTBLUE, "* Admin: %s(%d) has unfrozen you!", pName(playerid), playerid); SendFMessage(playerid, COLOR_LIGHTBLUE, "* You have unfrozen: %s(%d)!", pName(strval(params)), strval(params)); return TogglePlayerControllable(strval(params), 1); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:kick(playerid,params[]) { if(PVar[playerid][pLevel] >= 3) { new ID; if(unformat(params, "us[70]", ID, params)) return SendClientMessage(playerid, COLOR_RED,""#CRED"USAGE: "#CORANGE"/Kick < PlayerID > < Reason >"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); SendFMessageToAll(COLOR_LIGHTBLUE, "Admin: %s(%d) has kicked: %s(%d) reason: %s", pName(playerid), playerid, pName(ID), ID, params); return Kick(ID); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:ban(playerid, params[]) { if(PVar[playerid][pLevel] >= 4) { new PID; if(sscanf(params, "us[70]", PID, params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/Ban < Player ID > < Reason >"); if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!"); SendFMessage(PID, COLOR_LIGHTBLUE, "You have been banned by: %s(%d) for: %s", pName(playerid), playerid, params); SendFMessageToAll(COLOR_LIGHTBLUE, "Admin: %s(%d) has banned: %s(%d) for: %s", pName(playerid), playerid, pName(PID), PID, params); return BanEx(PID, params); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:freezeall(playerid, params[]) { if(PVar[playerid][pLevel] >= 4) { foreach(Player, i) TogglePlayerControllable(i, 1); SendFMessageToAll(COLOR_LIGHTBLUE, "* Admin: %s(%d) has frozen all players!", pName(playerid), playerid); return 1; } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:unfreezeall(playerid, params[]) { if(PVar[playerid][pLevel] >= 4) { foreach(Player, i) TogglePlayerControllable(i, 0); SendFMessageToAll(COLOR_LIGHTBLUE, "* Admin: %s(%d) has unfrozen all players!", pName(playerid), playerid); return 1; } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:v(playerid, params[]) { if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "* You must leave this vehicle to spawn a new one!"); new sCar, VehicleID, Float:X, Float:Y, Float:Z, Float:Ang, Int; if(unformat(params, "s[20]", params)) return SendClientMessage(playerid, COLOR_RED, ""#CRED"USAGE: "#CORANGE"/Car < CarID | Model >"); sCar = GetVehicleModelIDFromName(params); if(sCar < 400 || sCar > 611) return SendClientMessage(playerid, COLOR_RED, "* Invalid vehicle model!"); GetPlayerPos(playerid,X, Y, Z); GetPlayerFacingAngle(playerid, Ang); Int = GetPlayerInterior(playerid); VehicleID = CreateVehicle(sCar, X, Y, Z, Ang, -1, -1, -1); SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid)); PutPlayerInVehicle(playerid, VehicleID, 0); LinkVehicleToInterior(VehicleID, Int); SendFMessage(playerid, -1, ""#CORANGE"You have spawned a: "#CBLUE"%s "#CWHITE"- "#CBLUE"%d", VehicleNames[sCar - 400], sCar); return 1; } CMD:fix(playerid, params[]) { if(PVar[playerid][pLevel] >= 1) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "* You need A vehicle To Use this!"); return RepairVehicle(GetPlayerVehicleID(playerid)); } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } CMD:givemoney(playerid, params[]) { if(PVar[playerid][pLevel] >= 3) { new pID, pgMoney; if(sscanf(params, "ui", pID, pgMoney)) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/GiveMoney < Player ID > < Amount >"); if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "That user is not online!"); GivePlayerMoney(pID, pgMoney); SendFMessage(pID, -1, ""#CBLUE"Admin: "#CORANGE"%s(%d) "#CBLUE" has given you: "#CORANGE"$%i", pName(playerid), playerid, pgMoney); return 1; } else return SendClientMessage(playerid, COLOR_RED, "You are not admin!"); } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case REGISTER: { if(!response) { format(Msg, sizeof(Msg), ""#CBLUE"Player: "#CORANGE"%s(%d) "#CBLUE"has been kicked - Reason: Not registering!", pName(playerid), playerid); SendClientMessageToAll(COLOR_GREY, Msg); Kick(playerid); } else { if(!strlen(inputtext)) DialogInput(playerid, REGISTER, ""#CCADET"Account Registration", ""CYELLOW"You must enter a password below to continue!", "Register", "Leave"); new Query[100], EscPass[30], EscName[MAX_PLAYER_NAME]; mysql_real_escape_string(pName(playerid), EscName); mysql_real_escape_string(inputtext, EscPass); format(Query, sizeof(Query), "INSERT INTO `playerinfo` (`user`, `password`) VALUES ('%s', md5('%s'))", EscName, EscPass); mysql_query(Query); // Player has registered SendClientMessage(playerid, COLOR_CADETBLUE, "You are now registered!"); GivePlayerMoney(playerid, 5000); SetPVarInt(playerid, "LoggedIN", 1); // I use this for cross script } } case LOGIN: { if(!response) { format(Msg, sizeof(Msg), ""#CBLUE"Player: "#CORANGE"%s(%d) "#CBLUE"has been kicked - Reason: Not loggin in!", pName(playerid), playerid); SendClientMessageToAll(COLOR_GREY, Msg); Kick(playerid); } else { if(!strlen(inputtext)) DialogInput(playerid, LOGIN, ""#CCADET"Account Login", ""#CYELLOW"You must enter a password below to continue!", "Login", "Leave"); new EscPass[38], Query[128]; mysql_real_escape_string(inputtext, EscPass); format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = md5('%s')", pName(playerid), EscPass); mysql_query(Query); mysql_store_result(); if(mysql_num_rows() > 0) { LoadPlayerInfo(playerid); SetPVarInt(playerid, "LoggedIN", 1); // Player Has logged in SendClientMessage(playerid, COLOR_CADETBLUE, "You have been logged in"); } else { SendClientMessage(playerid, COLOR_RED, "You have entered an incorrect password, try again!"); DialogInput(playerid, LOGIN, ""#CCADET"Account Login", ""#CYELLOW"You have 3 chances to enter a correct password..", "Login", "Leave"); } } } } return 1; } stock LoadPlayerInfo(iPlayer) { new Query[700]; if(mysql_fetch_row(Query)) { sscanf(Query, "e<p<|>s[24]s[35]ddddfffd>", PVar[iPlayer]); // Remember to update this if you add more info... mysql_free_result(); } return 1; } stock SavePInfo(playerid) { if(GetPVarInt(playerid, "LoggedIN") == 1) { new Query[600]; format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d WHERE `user` = '%s'", // Also remember to update this... PVar[playerid][pKills], PVar[playerid][pDeaths], GetPlayerMoney(playerid), PVar[playerid][pLevel], PVar[playerid][pLastX], PVar[playerid][pLastY], PVar[playerid][pLastZ], GetPlayerInterior(playerid), pName(playerid)); mysql_query(Query); mysql_free_result(); return 1; } else return 0; } stock InitConnection(playerid) { new Query[90], EscName[MAX_PLAYER_NAME]; mysql_real_escape_string(pName(playerid), EscName); format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s'", EscName); mysql_query(Query); mysql_store_result(); if(mysql_num_rows() != 0) { format(Msg, sizeof(Msg), ""#CYELLOW"Welcome Back: "#CORANGE"%s(%d)\n"#CYELLOW"Please enter your password below to log onto your account..:", pName(playerid), playerid); DialogInput(playerid, LOGIN, ""#CCADET"Account Login", Msg, "Login", "Leave"); } else { format(Msg, sizeof(Msg), ""#CYELLOW"Hello: "#CORANGE"%s(%d)\n"#CYELLOW"This account is not registered! Enter a password below to continue..:", pName(playerid), playerid); DialogInput(playerid, REGISTER, ""#CCADET"Account Registration", Msg, "REGISTER", "LEAVE"); } mysql_free_result(); } stock ResetPVars(playerid) { PVar[playerid][pLevel] = 0; PVar[playerid][pKills] = 0; PVar[playerid][pDeaths] = 0; PVar[playerid][pMoney] = 0; PVar[playerid][pLastX] = 0.0; PVar[playerid][pLastY] = 0.0; PVar[playerid][pLastZ] = 0.0; PVar[playerid][pInt] = 0; } //============================================================================== // Dynamic Map Icons //============================================================================== stock AddMapIconFromFile() { new Str[67], MType, Float:MX, Float:MY, Float:MZ, MColor, Icons; mysql_query("SELECT * FROM `mapicons`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>fffii", MX, MY, MZ, MType, MColor); CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, MAPICONDISTANCE); Icons++; } } mysql_free_result(); printf("** %i\t<->\tMapIcons Loaded From\t<->\tMySQL\t\t **", Icons); return 1; } stock AddMapIconToFile(Float:MX, Float:MY, Float:MZ, MType, MColor) { new Query[200]; format(Query, sizeof(Query), "INSERT INTO `mapicons` (MapIconX, MapIconY, MapIconZ, MapIconType, MapIconColor) VALUES(%f, %f, %f, %d, %d)", MX, MY, MZ, MType, MColor); mysql_query(Query); mysql_free_result(); return 1; } //============================================================================== // Dynamic Vehicles //============================================================================== stock AddVehiclesFromFile() { new Str[67], dModel, Float:VX, Float:VY, Float:VZ, Float:VA, vTotal; mysql_query("SELECT * FROM `vehicles`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>iffff", dModel, VX, VY, VZ, VA); AddStaticVehicleEx(dModel, VX, VY, VZ, VA, -1, -1, (30 * 60)); vTotal++; } } mysql_free_result(); printf("** %i\t<->\tVehicles Loaded From\t<->\tMySQL\t\t **", vTotal); return 1; } stock AddVehicleToFile(Float:VX, Float:VY, Float:VZ, Float:VA, dModel) { new Query[200]; format(Query, sizeof(Query), "INSERT INTO `vehicles` (VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleAngle) VALUES(%d, %f, %f, %f, %f)", dModel, VX, VY, VZ, VA); mysql_query(Query); mysql_free_result(); return 1; } //============================================================================== // Dynamic Pickups //============================================================================== stock AddPickupFromFile() { new Str[67], PType, PModel, Float:PX, Float:PY, Float:PZ, pTotal; mysql_query("SELECT * FROM `pickups`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>fffii", PX, PY, PZ, PModel, PType); CreateDynamicPickup(PModel, PType, PX, PY, PZ, -1, -1, -1, PICKUPDISTANCE); pTotal++; } } mysql_free_result(); printf("** %i\t<->\tPickups Loaded From\t<->\tMySQL\t\t **", pTotal); return 1; } stock AddPickupToFile(Float:PX, Float:PY, Float:PZ, PModel, PType) { new Query[200]; format(Query, sizeof(Query), "INSERT INTO `pickups` (PickupX, PickupY, PickupZ, PickupModel, PickupType) VALUES(%f, %f, %f, %d, %d)", PX, PY, PZ, PModel, PType); mysql_query(Query); mysql_free_result(); return 1; } //============================================================================== // Dynamic 3D TextLabels //============================================================================== stock AddLabelsFromFile() { new Str[100], LabelInfo[128], Float:LX, Float:LY, Float:LZ, lTotal; mysql_query("SELECT * FROM `labels`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>fffs[128]", LX, LY, LZ, LabelInfo); CreateDynamic3DTextLabel(LabelInfo, RColors[random(sizeof(RColors))], LX, LY, LZ, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); lTotal++; } } mysql_free_result(); printf("** %i\t<->\tLabels Loaded From\t<->\tMySQL\t\t **", lTotal); return 1; } stock AddLabelToFile(LabelInfo[], Float:LX, Float:LY, Float:LZ) { new Query[160], EscString[128]; mysql_real_escape_string(LabelInfo, EscString); format(Query, sizeof(Query), "INSERT INTO `labels` (LabelX, LabelY, LabelZ, LabelInfo) VALUES(%f, %f, %f, '%s')", LX, LY, LZ, EscString); mysql_query(Query); mysql_free_result(); return 1; } GetVehicleModelIDFromName(vname[]) { for(new i = 0; i < 211; i++) { if (strfind(VehicleNames[i], vname, true) != -1) return i + 400; } return -1; } stock pName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; }