Jump to content
  • 0

Ajutor Drive-By


AleX1321

Question

Salut am o problema la un sistem Drive-By,totul merge bine si frumos pana cand cu armele personale ma sui pe motor/masina cu o arma personala si cand ma dau jos nu imi mai da arma trebuie sa imi dau respawn ca sa isi revina

[pawn]#include <a_samp>

public OnFilterScriptInit()

{

print(" Anti-Driveby succesfuly loaded.");

return 1;

}

public OnFilterScriptExit()

{

return 1;

}

new PlayerWeapon[MAX_PLAYERS][12];

new PlayerWeaponAmmo[MAX_PLAYERS][12];

public OnPlayerStateChange(playerid, newstate, oldstate)

{

if (newstate==PLAYER_STATE_DRIVER){

for(new i=0;i<12;i++){

GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid], PlayerWeaponAmmo[playerid]);

}

    ResetPlayerWeapons(playerid);

}

if (newstate==PLAYER_STATE_ONFOOT && oldstate==PLAYER_STATE_DRIVER){

for(new i=0;i<12;i++){

    GivePlayerWeapon(playerid, PlayerWeapon[playerid], PlayerWeaponAmmo[playerid]);

            GivePlayerWeapon(playerid, PlayerWeapon[playerid], PlayerWeaponAmmo[playerid]);

}

}

return 1;

}

[/pawn]

Si alta problema cu anti-swear merge doar in chat dar cand ii dau /w , /me, /m,etc nu merge ma puteti ajuta va rog acesta este [pawn]#include <a_samp>

#define MAX_LEN 32

#define MAX_ENTRY 120

static Swear[MAX_ENTRY][MAX_LEN];

public OnFilterScriptInit()

{

if(fexist("swear.txt")) {

new File:myFile,

line[MAX_LEN],

index=0;

myFile=fopen("swear.txt",filemode:io_read);

while(fread(myFile,line,sizeof line) && (index != MAX_ENTRY)) {

if(strlen(line)>MAX_LEN) continue;

StripNewLine(line);

strmid(Swear[index],line,0,strlen(line),sizeof line);

index++;

}

}

return 1;

}

public OnPlayerText(playerid,text[])

{

for(new i=0; i<MAX_ENTRY; i++) {

    if(!Swear[0]) continue;

Cenzura(text,Swear);

}

return 1;

}

stock StripNewLine(str[]) // ysi-misc.own

{

new l = strlen(str);

while (l-- && str[l] <= ' ') str[l] = '\0';

}

stock Cenzura(string[],word[],destch='*')

{

new start_index=(-1),

    end_index=(-1);

start_index=strfind(string,word,true);

if(start_index==(-1)) return false;

end_index=(start_index+strlen(word));

for( ; start_index<end_index; start_index++)

string[start_index]=destch;

return true;

}[/pawn]

si ultima problema este cu spike strip ma puteti ajuta sa il fac pentru cops?

[pawn]#include <a_samp>

//#define ALLOWED_PICKUPS 350 // Uncomment this if you know that you will never reach 2048 pickups.

#if defined ALLOWED_PICKUPS

new iPickups[ALLOWED_PICKUPS][5];

#else

new iPickups[MAX_PICKUPS][5];

#endif

forward DestroyStinger(stingerid);

public OnFilterScriptInit()

{

print(" >>> Spike Strips loaded.");

for(new i = 0; i < sizeof(iPickups); i++){

iPickups[0] = -1;

iPickups[1] = -1;

iPickups[2] = -1;

iPickups[3] = -1;

iPickups[4] = -1;

}

return 1;

}

public OnFilterScriptExit()

{

for(new i = 0; i < sizeof(iPickups); i++){

    DestroyObject(iPickups[0]);

        DestroyPickup(iPickups[1]);

        DestroyPickup(iPickups[2]);

        DestroyPickup(iPickups[3]);

        DestroyPickup(iPickups[4]);

}

return 1;

}

public OnPlayerCommandText(playerid, cmdtext[])

{

if (strcmp("/stinger", cmdtext, true, 8) == 0)

{

    new vehicleid = GetPlayerVehicleID(playerid);

    if(vehicleid == 0){

    new Float:X, Float:Y, Float:Z, Float:A;

    GetPlayerPos(playerid, X, Y, Z);

    GetPlayerFacingAngle(playerid, A);

CreateSmallStinger(X+(6.0*floatsin(-A, degrees)), Y+(6.0*floatcos(-A, degrees)), Z-0.825, A, GetPlayerVirtualWorld(playerid), 60000);

}

    else{

    new Float:X, Float:Y, Float:Z, Float:A;

    GetVehiclePos(vehicleid, X, Y, Z);

    GetVehicleZAngle(vehicleid, A);

CreateLargeStinger(X-(10.0*floatsin(-A, degrees)), Y-(10.0*floatcos(-A, degrees)), Z-0.325, A, GetPlayerVirtualWorld(playerid), 60000);

    }

    return 1;

}

if (strcmp("/destroystinger", cmdtext, true, 15) == 0)

{

    new Float:X, Float:Y, Float:Z;

    for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){

        if(iPickups[stingerid][0] == -1)

            continue;

     

        GetObjectPos(iPickups[stingerid][0], X, Y, Z);

        if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z)){

            DestroyStinger(stingerid);

            break;

        }

    }

    return 1;

}

return 0;

}

public OnPlayerPickUpPickup(playerid, pickupid)

{

    for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){

    if(pickupid == iPickups[stingerid][1]){

    new Float:X, Float:Y, Float:Z, Float:A;

    GetObjectPos(iPickups[stingerid][0], X, Y, Z);

    GetObjectRot(iPickups[stingerid][0], A, A, A);

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

        PopPlayerTires(playerid);

        DestroyPickup(pickupid);

        if(iPickups[stingerid][3] == -1){ // Small Stinger

            iPickups[stingerid][1] = CreatePickup(1007, 14, X+(1.5*dis1), Y+(1.5*dis2), Z, GetPlayerVirtualWorld(playerid));

        }

        else{ // Large Stinger

iPickups[stingerid][1] = CreatePickup(1007, 14, X+(4.0*dis1), Y+(4.0*dis2), Z, GetPlayerVirtualWorld(playerid));

        }

        break;

    }

    else if(pickupid == iPickups[stingerid][2]){

    new Float:X, Float:Y, Float:Z, Float:A;

    GetObjectPos(iPickups[stingerid][0], X, Y, Z);

    GetObjectRot(iPickups[stingerid][0], A, A, A);

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

        PopPlayerTires(playerid);

        DestroyPickup(pickupid);

        if(iPickups[stingerid][3] == -1){ // Small Stinger

            iPickups[stingerid][2] = CreatePickup(1007, 14, X-(1.5*dis1), Y-(1.5*dis2), Z, GetPlayerVirtualWorld(playerid));

        }

        else{ // Large Stinger

iPickups[stingerid][2] = CreatePickup(1007, 14, X+(1.25*dis1), Y+(1.25*dis2), Z, GetPlayerVirtualWorld(playerid));

        }

        break;

    }

    else if(pickupid == iPickups[stingerid][3]){

    new Float:X, Float:Y, Float:Z, Float:A;

    GetObjectPos(iPickups[stingerid][0], X, Y, Z);

    GetObjectRot(iPickups[stingerid][0], A, A, A);

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

        PopPlayerTires(playerid);

        DestroyPickup(pickupid);

iPickups[stingerid][3] = CreatePickup(1007, 14, X-(4.0*dis1), Y-(4.0*dis2), Z, GetPlayerVirtualWorld(playerid));

        break;

    }

    else if(pickupid == iPickups[stingerid][4]){

    new Float:X, Float:Y, Float:Z, Float:A;

    GetObjectPos(iPickups[stingerid][0], X, Y, Z);

    GetObjectRot(iPickups[stingerid][0], A, A, A);

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

        PopPlayerTires(playerid);

        DestroyPickup(pickupid);

iPickups[stingerid][4] = CreatePickup(1007, 14, X-(1.25*dis1), Y-(1.25*dis2), Z, GetPlayerVirtualWorld(playerid));

        break;

    }

    }

return 1;

}

stock PopPlayerTires(playerid){

new vehicleid = GetPlayerVehicleID(playerid);

if(vehicleid != 0){

new panels, doors, lights, tires;

GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);

UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 15);

}

}

stock CreateLargeStinger(Float:X, Float:Y, Float:Z, Float:A, virtualworld, timer){

for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){

if(iPickups[stingerid][0] == -1){

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

iPickups[stingerid][0] = CreateObject(2892, X, Y, Z, 0.0, 0.0, A);

iPickups[stingerid][1] = CreatePickup(1007, 14, X+(4.0*dis1), Y+(4.0*dis2), Z, virtualworld);

iPickups[stingerid][2] = CreatePickup(1007, 14, X+(1.25*dis1), Y+(1.25*dis2), Z, virtualworld);

iPickups[stingerid][3] = CreatePickup(1007, 14, X-(4.0*dis1), Y-(4.0*dis2), Z, virtualworld);

iPickups[stingerid][4] = CreatePickup(1007, 14, X-(1.25*dis1), Y-(1.25*dis2), Z, virtualworld);

if(timer > 0){

SetTimerEx("DestroyStinger", timer, 0, "i", stingerid);

}

return stingerid;

}

}

return -1;

}

stock CreateSmallStinger(Float:X, Float:Y, Float:Z, Float:A, virtualworld, timer){

for(new stingerid = 0; stingerid < sizeof(iPickups); stingerid++){

if(iPickups[stingerid][0] == -1){

    new Float:dis1 = floatsin(-A, degrees), Float:dis2 = floatcos(-A, degrees);

iPickups[stingerid][0] = CreateObject(2899, X, Y, Z, 0.0, 0.0, A);

iPickups[stingerid][1] = CreatePickup(1007, 14, X+(1.5*dis1), Y+(1.5*dis2), Z, virtualworld);

iPickups[stingerid][2] = CreatePickup(1007, 14, X-(1.5*dis1), Y-(1.5*dis2), Z, virtualworld);

if(timer > 0){

SetTimerEx("DestroyStinger", timer, 0, "i", stingerid);

}

return stingerid;

}

}

return -1;

}

public DestroyStinger(stingerid){

DestroyObject(iPickups[stingerid][0]);

DestroyPickup(iPickups[stingerid][1]);

DestroyPickup(iPickups[stingerid][2]);

DestroyPickup(iPickups[stingerid][3]);

DestroyPickup(iPickups[stingerid][4]);

iPickups[stingerid][0] = -1;

iPickups[stingerid][1] = -1;

iPickups[stingerid][2] = -1;

iPickups[stingerid][3] = -1;

iPickups[stingerid][4] = -1;

}[/pawn]

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.