Jump to content

Recommended Posts

Posted

    Ok, am vrut sa fac un sistem de spike uri pentru politisti. Problema este ca nu i se da remove. Un solve va rog??

 

if (strcmp("/pdspikes", cmdtext, true, 10) == 0)
    {
        new Float:Pos[4];
        GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
        GetPlayerFacingAngle(playerid, Pos[3]);
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Placed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Deployed!",3000,4);
        CreateDynamicObject(2899, Pos[0],Pos[1],Pos[2]-0.9, 00.00,  00.00,  Pos[3]+90);
        return 1;
    }
    if (strcmp("/removepdspikes", cmdtext, true, 10) == 0)
// Problema
    {
        new Float:Pos[4];
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
        GetPlayerFacingAngle(playerid, Pos[3]);
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Removed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Removed!",3000,4);
        GetObjectPos(2899, x, y, z);
        DestroyDynamicObject(2899);
        return 1;
    }

Posted
8 hours ago, AlexCelTare said:

da normal:))) btw sti sa ma rezolvi?

nici n am habar,lasa mi steamu sa bagam un csnz candva =],maine daca e sau cand e timp,uite aici discordul meu ca sa nu mai provoc off topic :

eLtRaCk.#9644

 

Posted (edited)

Nu trebuie sa dai destroy la id-ul obiectului in sine, ci la id-ul lui de pe server, adica al catelea a fost creat pe server (ca la vehicule).

Ai putea sa faci ceva de genul (dar asta va functiona pentru un singur spike per player):


new Spike[MAX_PLAYERS];

if (strcmp("/pdspikes", cmdtext, true, 10) == 0)
{

        if(Spike[playerid] > 0) return SendClientMessage(playerid, -1, "Ai creat deja un Spike!");
        new Float:Pos[4];
        GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
        GetPlayerFacingAngle(playerid, Pos[3]);
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Placed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Deployed!",3000,4);
        Spike[playerid] = CreateDynamicObject(2899, Pos[0],Pos[1],Pos[2]-0.9, 00.00,  00.00,  Pos[3]+90);
        return 1;
    }


    if (strcmp("/removepdspikes", cmdtext, true, 10) == 0)
    {

        if(Spike[playerid] == 0)  return SendClientMessage(playerid, -1, "Nu ai creat nici un Spike!");
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Removed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Removed!",3000,4);
        DestroyDynamicObject(Spike[playerid]), 
Spike[playerid] = 0;
        return 1;
    }

Edited by Akan
  • Thanks 1

Discord:
! Akan !#6675

Posted
20 hours ago, Akan said:

Nu trebuie sa dai destroy la id-ul obiectului in sine, ci la id-ul lui de pe server, adica al catelea a fost creat pe server (ca la vehicule).

Ai putea sa faci ceva de genul (dar asta va functiona pentru un singur spike per player):


new Spike[MAX_PLAYERS];

if (strcmp("/pdspikes", cmdtext, true, 10) == 0)
{

        if(Spike[playerid] > 0) return SendClientMessage(playerid, -1, "Ai creat deja un Spike!");
        new Float:Pos[4];
        GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
        GetPlayerFacingAngle(playerid, Pos[3]);
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Placed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Deployed!",3000,4);
        Spike[playerid] = CreateDynamicObject(2899, Pos[0],Pos[1],Pos[2]-0.9, 00.00,  00.00,  Pos[3]+90);
        return 1;
    }


    if (strcmp("/removepdspikes", cmdtext, true, 10) == 0)
    {

        if(Spike[playerid] == 0)  return SendClientMessage(playerid, -1, "Nu ai creat nici un Spike!");
        SendClientMessage(playerid, 0xF31C2B, "*Succesfully Removed Spike*");
        GameTextForPlayer(playerid,"~r~Police Spike ~n~~b~Spike Removed!",3000,4);
        DestroyDynamicObject(Spike[playerid]), 
Spike[playerid] = 0;
        return 1;
    }

multumesc mult bro, solved

  • Mister locked this topic
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.