23.12.2010, 06:12
I want the object disappear after 10 second if no one pick it..
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
new string[256];
new sendername[MAX_PLAYER_NAME];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/dropgun", true) == 0 || strcmp(cmd, "/dgun", true) == 0)
{
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
if(gunID != 0 && gunAmmo != 0)
{
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(ObjCoords); a++)
{
if(ObjCoords[a][0] == 0.0)
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "You can not throw weapons at the moment, try back later!!");
new gunname[25];
new buffer[100];
GetWeaponNameEx(gunID, gunname, sizeof(gunname));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(buffer, sizeof(buffer), "You threw %s", gunname);
SendClientMessage(playerid, 0x33AA3300, buffer);
RemovePlayerWeapon(playerid, gunID);
ObjectID[f][0] = gunID;
ObjectID[f][1] = gunAmmo;
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateObject(GunObjects[gunID][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0);
{
format(string, sizeof(string), "* %s drop their %s.", sendername, gunname);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
return 1;
}
}