03.12.2012, 13:45
This on OnPlayerCommandText
This on OnGameModeInit
Код:
if(strcmp(cmdtext, "/grab", true)==0) { new name[MAX_PLAYER_NAME]; if(MedicBill[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " You have no access to grab items at your health."); return 1; } for(new i = 0; i < sizeof(DropInfo); i++) { if (PlayerToPoint(1.0,playerid,DropInfo[i][dx],DropInfo[i][dy],DropInfo[i][dz])) { if(GetPlayerVirtualWorld(playerid) == DropInfo[i][dWorld]) { if(DropInfo[i][dType] == 2) // Crack { ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0); SetTimerEx("crackpick", 3000, 0, "i", playerid); format(string, sizeof(string), "You kneel down to pick up some crack."); SendClientMessage(playerid, COLOR_GREY, string); } return 1; } } } return 1; }
Код:
forward crackpick(playerid); public crackpick(playerid) { for(new i = 0; i < sizeof(DropInfo); i++) { if (PlayerToPoint(1.0,playerid,DropInfo[i][dx],DropInfo[i][dy],DropInfo[i][dz])) { if(GetPlayerVirtualWorld(playerid) == DropInfo[i][dWorld]) { DestroyObject(DropObject[i]); DropInfo[i][dx] = 0.0; DropInfo[i][dy] = 0.0; DropInfo[i][dz] = 0.0; if(DropInfo[i][dType] == 2) // Crack { new string[256]; format(string,sizeof(string),"* %s picks up %d grams of crack.",Name(playerid),DropInfo[i][dAmount]); ProxDetector(30.0,playerid,string,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED); PlayerInfo[playerid][pCrack] += DropInfo[i][dAmount][0]; DropInfo[i][dAmount][0] = 0; DropInfo[i][dAmount][1] = 0; DropInfo[i][dType] = 0; } } } } }
Код:
for(new i = 0; i < sizeof(DropInfo); i++) { if(DropInfo[i][dx] != 0.0 && DropInfo[i][dy] != 0.0 && DropInfo[i][dz] != 0.0) { if(DropInfo[i][dType] == 1) { if (DropInfo[i][dAmount][0] > 1 || DropInfo[i][dAmount][0] < 35) { DropObject[i] = CreateObject(gh_GetObjectID(DropInfo[i][dAmount][0]), DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1,93.7,120.0,120.0, DropInfo[i][dWorld]); } } else if(DropInfo[i][dType] == 2) // Crack { DropObject[i] = CreateObject(1575, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } else if(DropInfo[i][dType] == 3) // Pot { DropObject[i] = CreateObject(1578, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } else if(DropInfo[i][dType] == 4) // Mats A { DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } else if(DropInfo[i][dType] == 5) // Mats B { DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } else if(DropInfo[i][dType] == 6) // Mats C { DropObject[i] = CreateObject(2040, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } else if(DropInfo[i][dType] == 7) // Money { DropObject[i] = CreateObject(1212, DropInfo[i][dx], DropInfo[i][dy], DropInfo[i][dz]-1, 0, 0, 0, 200.0, DropInfo[i][dWorld]); } } }