01.11.2010, 08:31
Код:
//--Weponz Trick'Or'Treat System!--// #include <a_samp> #include <CheckpointManager> #include <dini> #include <dudb> #pragma unused ret_memcpy #define FILTERSCRIPT #define COLOR_RED 0xFF0000FF #define TRICK_OR_TREAT1 1 #define TRICK_OR_TREAT2 2 #define TRICK_OR_TREAT3 3 #define TRICK_OR_TREAT4 4 new bool:trickortreat[MAX_PLAYERS]; new bool:cantrickortreat[MAX_PLAYERS]; new bool:waittrickortreat[MAX_PLAYERS]; forward OnCheckpointEXIT(playerid, checkpointid); forward waittreat(playerid); forward treattimer(); forward treat(playerid); enum pInfo { TreatAmount, } new PlayerInfo[MAX_PLAYERS][pInfo]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Weponz Trick'Or'Treat System Loaded!"); print("--------------------------------------\n"); CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT1, -1460.6313,-1452.2644,101.7578, 2.0);//Coordz Random Need To Be Set! CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT2, -1459.6176,-1561.0852,101.7578, 2.0);// CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT3, -1083.4073,-1264.9041,129.2188, 2.0);// CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT4, -1025.8848,-1252.8379,130.2696, 2.0);// StartCheckpointSeeking(); return 1; } public OnFilterScriptExit() { return 1; } #endif public OnPlayerSpawn(playerid) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/candy", cmdtext, true) == 0) { new ammount[64]; format(ammount, sizeof(ammount),"You have %d Candy!",PlayerInfo[playerid][TreatAmount] ); SendClientMessage(playerid, COLOR_RED, "-----Fuel Ammount-----"); SendClientMessage(playerid, COLOR_RED, ammount); return 1; } if(!strcmp(cmdtext,"/trickortreat",true))//Weponz { if (IsPlayerInCheckpoint(playerid)) if(waittrickortreat[playerid] == true) { SendClientMessage(playerid, COLOR_RED, "Please wait before Trick'Or'Treating again!"); } if(cantrickortreat[playerid] == true) { if(trickortreat[playerid] == false) { new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "%s is Trick'Or'Treating right now!", str, cmdtext[4]); SendClientMessageToAll(COLOR_RED, str); GameTextForPlayer(playerid, "~w~Your Trick'Or'Treating! ~r~Please wait!",10000,5); SetTimerEx("waittreat", 10000, false, "d", playerid); trickortreat[playerid] = true; } else { SendClientMessage(playerid, COLOR_RED, "You are Trick'Or'Treating!"); } } else { SendClientMessage(playerid, COLOR_RED, "You need to be in a Checkpoint to Trick'Or'Treat! "); } return 1; } return 0; } public OnPlayerLeaveCheckpoint(playerid) { VerifyCheckpointe(playerid); return 1; } public OnPlayerEnterCheckpoint(playerid) { VerifyCheckpoint(playerid); return 1; } public OnCheckpointEXIT(playerid, checkpointid) switch(checkpointid) { case TRICK_OR_TREAT1: { if(cantrickortreat[playerid] == true) { cantrickortreat[playerid] = false; if(trickortreat[playerid] == true) { trickortreat[playerid] = false; GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5); SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!"); } } } case TRICK_OR_TREAT2: { if(cantrickortreat[playerid] == true) { cantrickortreat[playerid] = false; if(trickortreat[playerid] == true) { trickortreat[playerid] = false; GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5); SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!"); } } } case TRICK_OR_TREAT3: { if(cantrickortreat[playerid] == true) { cantrickortreat[playerid] = false; if(trickortreat[playerid] == true) { trickortreat[playerid] = false; GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5); SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!"); } } } case TRICK_OR_TREAT4: { if(cantrickortreat[playerid] == true) { cantrickortreat[playerid] = false; if(trickortreat[playerid] == true) { trickortreat[playerid] = false; GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5); SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!"); } } } } public OnCheckpointEnter(playerid, checkpointid) { switch(checkpointid) { case TRICK_OR_TREAT1: { cantrickortreat[playerid] = true; { GameTextForPlayer(playerid, "~r~/trickortreat",4000,5); } } case TRICK_OR_TREAT2: { cantrickortreat[playerid] = true; { GameTextForPlayer(playerid, "~r~/trickortreat",4000,5); } } case TRICK_OR_TREAT3: { cantrickortreat[playerid] = true; { GameTextForPlayer(playerid, "~r~/trickortreat",4000,5); } } case TRICK_OR_TREAT4: { cantrickortreat[playerid] = true; { GameTextForPlayer(playerid, "~r~/trickortreat",4000,5); } } } } public treat(playerid) { new str[128]; new name[MAX_PLAYER_NAME]; format(str, sizeof(str), "You just got some more Candy! Use /candy to see your Candy Supply!"); SendClientMessage(playerid, COLOR_RED, str); GetPlayerName(playerid,name,18); format(str, sizeof(str), "%s has just got some more Candy! Use /trickortreat at any Candy Checkpoint for some Candy!",name,playerid); SendClientMessageToAll(COLOR_RED,str); SetTimerEx("waittreat", 10000, false, "d", playerid); trickortreat[playerid] = false; PlayerInfo[playerid][TreatAmount] = PlayerInfo[playerid][TreatAmount] +100; format(str, sizeof(str), "~r~Trick Or Treat!~n~~w~You have an extra 100 Candy Now!"); GameTextForPlayer(playerid, str ,4000,5); return 1; } public waittreat(playerid) { waittrickortreat[playerid] = false; return 1; }