Car Bomb
#1

Can someone point me towards a carbomb script, or maybe a tutorial?

Specs:

Player needs to have to go somewhere to buy the bomb
Player needs to /detonate and kill whoever is in the car with a big explosion
Player should be able to see who is in the car

Kinda like the system on SACnR (SA Cops & Robbers)


Thanks
-Kevin
Crazy Awesome, Owner

PS I'm a noob at scripting and would appreciate someone helping me out or scriping it for me.
Reply
#2

Read this page https://sampwiki.blast.hk/wiki/Explosion_List
Reply
#3

add this on top of ur script:
pawn Код:
new HasC4[MAX_PLAYERS];
new C4Placed[MAX_PLAYERS];
pawn Код:
public OnPlayerSpawn(playerid)
{
  HasC4[playerid] =0;
  C4Placed[playerid] =0;
}
the buy script:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)//or something else
{
  if(HasC4[playerid] =1)
  {
    SendClientMessage(playerid,COLOR_RED,"You already own C4");
  }
  if(cash >= 14999)
  {
     SendClientMessage(playerid,COLOR_RED,"You Don't have enough cash");
   }
  HasC4[playerid] =1;
  GivePlayerMoney(playerid, -15000);
}
the rest of the script:
pawn Код:
if(!strcmp(cmd,"/placeC4",true))
{
   if(IsPlayerInVehicleAnyVehicle(playerid))
   {
      new bomb, Float:x,Float:y,Float:z;
      bomb = IsValidObject(1252);
      GetPlayerPos(playerid,x,y,z);
      CreateObject(bomb,x,y,z+1,0,0,0);
      HasC4[playerid] =0;
      C4Placed[playerid] =1;
   }
}
if(!strcmp(cmd,"/detonateC4",true))
{
if(C4Placed[playerid] =0)
  {
     SendClientMessage(playerid,COLOR_RED,"You Haven't placed C4");
  }
   new bomb - IsValidObject(1252);
   new Float:bx,Float:by,Float:bz;
   GetObjectPos(bomb,bx,by,bz);
   CreateExplosion(bx,by,bz+1,7,10);
   DestroyObject(bomb);
   C4Placed[playerid] =0);
}
i hope this will work
Reply
#4

Tell me if my code worked
Reply
#5

i got this....



Код:
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9010) : error 017: undefined symbol "cmd"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9012) : error 017: undefined symbol "IsPlayerInVehicleAnyVehicle"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9015) : error 021: symbol already defined: "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9014) : warning 204: symbol is assigned a value that is never used: "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9014 -- 9022) : error 017: undefined symbol "cmd"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9014 -- 9024) : warning 211: possibly unintended assignment
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9028) : error 001: expected token: ";", but found "-"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : error 001: expected token: "]", but found ")"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : error 029: invalid expression, assumed zero
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : warning 215: expression has no effect
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(10986) : warning 211: possibly unintended assignment
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(10990) : error 017: undefined symbol "cash"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#6

wtf do you people indent with? space?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)//or something else
{
    if(HasC4[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You already own C4");
    }
    if(GetPlayerMoney(playerid) >= 14999)
    {
        SendClientMessage(playerid,COLOR_RED,"You Don't have enough cash");
    }
    HasC4[playerid] =1;
    GivePlayerMoney(playerid, -15000);
}

if(!strcmp(cmdtext,"/placeC4",true))
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new bomb = IsValidObject(1252);
        new bomb, Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateObject(bomb,x,y,z+1,0,0,0);
        HasC4[playerid] =0;
        C4Placed[playerid] =1;
    }
}
if(!strcmp(cmdtext,"/detonateC4",true))
{
    if(C4Placed[playerid] == 0)
    {
        SendClientMessage(playerid,COLOR_RED,"You Haven't placed C4");
    }
    if(C4Placed[playerid] != 0)
    new bomb - IsValidObject(1252);
    new Float:bx,Float:by,Float:bz;
    GetObjectPos(bomb,bx,by,bz);
    CreateExplosion(bx,by,bz+1,7,10);
    DestroyObject(bomb);
    C4Placed[playerid =0);
}
Reply
#7

Quote:
Originally Posted by Kar
Посмотреть сообщение
wtf do you people indent with? space?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)//or something else
{
    if(HasC4[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You already own C4");
    }
    if(GetPlayerMoney(playerid) >= 14999)
    {
        SendClientMessage(playerid,COLOR_RED,"You Don't have enough cash");
    }
    HasC4[playerid] =1;
    GivePlayerMoney(playerid, -15000);
}

if(!strcmp(cmdtext,"/placeC4",true))
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new bomb = IsValidObject(1252);
        new bomb, Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CreateObject(bomb,x,y,z+1,0,0,0);
        HasC4[playerid] =0;
        C4Placed[playerid] =1;
    }
}
if(!strcmp(cmdtext,"/detonateC4",true))
{
    if(C4Placed[playerid] == 0)
    {
        SendClientMessage(playerid,COLOR_RED,"You Haven't placed C4");
    }
    if(C4Placed[playerid] != 0)
    new bomb - IsValidObject(1252);
    new Float:bx,Float:by,Float:bz;
    GetObjectPos(bomb,bx,by,bz);
    CreateExplosion(bx,by,bz+1,7,10);
    DestroyObject(bomb);
    C4Placed[playerid =0);
}

Код:
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9014) : error 021: symbol already defined: "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9013) : warning 204: symbol is assigned a value that is never used: "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9028) : error 003: declaration of a local variable must appear in a compound block
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9028) : error 017: undefined symbol "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9028) : warning 215: expression has no effect
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9030) : error 017: undefined symbol "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9032) : error 017: undefined symbol "bomb"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : error 001: expected token: "]", but found ")"
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : error 029: invalid expression, assumed zero
C:\Users\owner\Desktop\my samp server\my samp server - Copy\gamemodes\stunt.pwn(9033) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
Reply
#8

POST EACH LINE THAT HAS A ERROR ON IT
Reply
#9

The errors seem to be coming from the OnPlayerCommandText commands
I tried using this, and when i do "new bomb;" at the top of the script i get an error saying "Bomb is already defined" but if i remove it, "Bomb isn't defined"
Reply
#10

i only get these errors when i insert the code u gave me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)