28.02.2012, 11:38
How i can make like if player planted bomb no one else can take it only the play who plant the bomb can take and
how i can make if someone type /blowbomb blow up his own bomb not others bomb please help!
Thanks
how i can make if someone type /blowbomb blow up his own bomb not others bomb please help!
Thanks
pawn Код:
if(strcmp(cmd, "/plantbomb", true, 10) == 0){
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(gTeam[playerid] != TEAM_SWAT) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a Swat Officer");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(HaveSwatBomb[playerid] == 0){
SendClientMessage(playerid,COLOR_GREEN,"There is no c4's with you!.");
return 1;
}
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SendClientMessage(playerid,GetPlayerColor(playerid),"You planted the c4!. You can /takebomb to take it or You can /blowbomb to blow it");
HaveSwatBomb[playerid] =0;
GetPlayerPos(playerid,x,y,z);
CreateObject(swatbomb,x,y,z-0.5,0.0,0.0,0.0);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
return 1;
}
if(strcmp(cmd, "/takebomb", true, 9) == 0) {
new Float:x,Float:y,Float:z;
new Float:ox,Float:oy,Float:oz;
GetPlayerPos(playerid,x,y,z);
GetObjectPos(swatbomb,ox,oy,oz);
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(gTeam[playerid] != TEAM_SWAT) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a Swat Officer");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(!IsPlayerInRangeOfPoint(playerid,1.0,ox,oy,oz)){
SendClientMessage(playerid, COLOR_ERROR, "You are not behind bomb to take it up!");
return 1;
}
if(HaveSwatBomb[playerid] == 1){
SendClientMessage(playerid,COLOR_GREEN,"You already got the c4!. Use /plantbomb to plant it");
return 1;
}
SendClientMessage(playerid,COLOR_GREEN,"You have picked up swat bomb!. You can use /plantbomb to plant it!");
HaveSwatBomb[playerid] =1;
return 1;
}
if(strcmp(cmd, "/blowbomb", true, 9) == 0) {
new Float:x,Float:y,Float:z;
new Float:ox,Float:oy,Float:oz;
GetPlayerPos(playerid,x,y,z);
GetObjectPos(swatbomb,ox,oy,oz);
if(IsSpawned[playerid] == 0) {
SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
return 1;
}
if(gTeam[playerid] != TEAM_SWAT) {
SendClientMessage(playerid,COLOR_ERROR,"You are not a Swat Officer");
return 1;
}
if(Jailed[playerid] ==1) {
SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
return 1;
}
if(HaveSwatBomb[playerid] == 1){
SendClientMessage(playerid,COLOR_GREEN,"You already got the c4!. Use /plantbomb to plant it");
return 1;
}
if(SwatBombPlanted[playerid] == 0){
SendClientMessage(playerid,COLOR_GREEN,"You need to get swat bomb from swat base!");
return 1;
}
SendClientMessage(playerid,COLOR_GREEN,"You have blowed up the bomb!. You can refill from swat base");
CreateExplosion(ox,oy,oz,2,10.0);
HaveSwatBomb[playerid] =0;
SwatBombPlanted[playerid] =0;
return 1;
}