Jump to content
  • 0

Comanda /dmv


bogdaNNNNN

Question

Salut, am facut aceasta comanda, dar ma teleporteaza doar pe mine.. cum fac sa teleporteze si alti playeri la acele Coordonate?

Citat

CMD:dmv(playerid, params[]){
if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pHelper] < 3) return SendClientMessage(playerid, COLOR_WHITE,AdminOnly);
new string[250];
new id;
    if(sscanf(params, "fff")) return SendClientMessage(playerid, -1, "USAGE: /dmv <id>");
    if(IsPlayerInAnyVehicle(playerid))
    SetVehiclePos(GetPlayerVehicleID(playerid),1218.9750,-1812.7285,16.5938);
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    SetPlayerPos(playerid, 1218.9750,-1812.7285,16.5938);
SetPlayerInterior(playerid,0);
    
    return 1;
}

 

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

Vrei ca in calitate de admin/helper la tastarea comenzi sa teleportezi x player la acele coordonate? Sau vrei ca toata lumea sa aibe acces la comanda?

Pentru primul caz foloseste sscanf:

CMD:dmv(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pHelper] < 3) return SendClientMessage(playerid, COLOR_WHITE,AdminOnly);
    new string[250];
    new id;
    if(sscanf(params, "u")) return SendClientMessage(playerid, -1, "USAGE: /dmv <id>");

    if(IsPlayerInAnyVehicle(id))
        SetVehiclePos(GetPlayerVehicleID(id),1218.9750,-1812.7285,16.5938);

    if(GetPlayerState(id) == PLAYER_STATE_ONFOOT)
        SetPlayerPos(id, 1218.9750,-1812.7285,16.5938);
    
    SetPlayerInterior(id,0);
    
    return 1;
}

In felul asta. Ce ai facut tu nu avea logica. Pentru a folosi numele/id-ul unui jucator intr-o comanda(mai exact sa ii faci ceva acelui jucator) folosesti sscanf cu acel u (u = playerid/playername) care va indentifica automat jucaotrul

Pentru al doilea caz doar sterge acel if de la inceput cu pAdmin si pHelper

Link to comment
Share on other sites

  • 0
3 minutes ago, bogdaNNNNN said:

Multumesc mult <3 

A uitat sa verifice daca ID-ul este conectat, uite aici comanda:

 

CMD:dmv(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pHelper] < 3) return SendClientMessage(playerid, COLOR_WHITE,AdminOnly);
    new string[250];
    new id;
    if(sscanf(params, "u")) return SendClientMessage(playerid, -1, "USAGE: /dmv <id>");

    if(!IsPlayerConnected(id) && gPlayerLogged[id] == 1) return SCM(playerid, -1, "ERROR: Player not connected");

    if(IsPlayerInAnyVehicle(id))
        SetVehiclePos(GetPlayerVehicleID(id),1218.9750,-1812.7285,16.5938);

    if(GetPlayerState(id) == PLAYER_STATE_ONFOOT)
        SetPlayerPos(id, 1218.9750,-1812.7285,16.5938);
    
    SetPlayerInterior(id,0);
    
    return 1;
}
Link to comment
Share on other sites

  • 0
Acum 21 minute, bogdaNNNNN a spus:

Am incercat comanda, tot pe mine ma teleporteaza..

CMD:dmv(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pHelper] < 3) return SendClientMessage(playerid, COLOR_WHITE,AdminOnly);
    new string[250];
    new id;
    if(sscanf(params, "u",id)) return SendClientMessage(playerid, -1, "USAGE: /dmv <id>");

    if(!IsPlayerConnected(id) && gPlayerLogged[id] == 1) return SCM(playerid, -1, "ERROR: Player not connected");

    if(IsPlayerInAnyVehicle(id))
        SetVehiclePos(GetPlayerVehicleID(id),1218.9750,-1812.7285,16.5938);

    if(GetPlayerState(id) == PLAYER_STATE_ONFOOT)
        SetPlayerPos(id, 1218.9750,-1812.7285,16.5938);
    
    SetPlayerInterior(id,0);
    
    return 1;
}

if(sscanf(params, "u",id)) // lipsea id.

 

Edited by valivaly96
Link to comment
Share on other sites

  • 0
Acum 13 ore, RazvaN. a spus:

A uitat sa verifice daca ID-ul este conectat, uite aici comanda:

 


CMD:dmv(playerid, params[]){
    if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pHelper] < 3) return SendClientMessage(playerid, COLOR_WHITE,AdminOnly);
    new string[250];
    new id;
    if(sscanf(params, "u")) return SendClientMessage(playerid, -1, "USAGE: /dmv <id>");

    if(!IsPlayerConnected(id) && gPlayerLogged[id] == 1) return SCM(playerid, -1, "ERROR: Player not connected");

    if(IsPlayerInAnyVehicle(id))
        SetVehiclePos(GetPlayerVehicleID(id),1218.9750,-1812.7285,16.5938);

    if(GetPlayerState(id) == PLAYER_STATE_ONFOOT)
        SetPlayerPos(id, 1218.9750,-1812.7285,16.5938);
    
    SetPlayerInterior(id,0);
    
    return 1;
}

Nu este nevoie sa verifici daca este sau nu conectat... pentru ca in primul si in primul rand persoana daca nu este conectata nu poate sa foloseasca comenzi sau sa se foloseasca pe el :D asta e o porcarie din scripturile de acum 100 de ani :P

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

  • 0
Acum 6 minute, StR_Marian a spus:

Nu este nevoie sa verifici daca este sau nu conectat... pentru ca in primul si in primul rand persoana daca nu este conectata nu poate sa foloseasca comenzi sau sa se foloseasca pe el :D asta e o porcarie din scripturile de acum 100 de ani :P

Prostie e sa verifici daca playerid este conectat, dar sa verifici daca x id este conectat este o necesitate(nu in cazul de fata) pentru ca poti avea de a face cu PlayerInfo si daca pasezi INVALID_PLAYER_ID catre PlayerInfo estee posibil sa ai de a face cu Index out of bounds si posibil crash

Link to comment
Share on other sites

  • 0
2 hours ago, StR_Marian said:

Nu este nevoie sa verifici daca este sau nu conectat... pentru ca in primul si in primul rand persoana daca nu este conectata nu poate sa foloseasca comenzi sau sa se foloseasca pe el :D asta e o porcarie din scripturile de acum 100 de ani :P

Esti prea noob, poti sa te lasi. Daca nu faci aceea verificare, nu va avea pe cine sa teleporteze :| , Daca nu stii nici sa faci o comanda, e grav rau.

Link to comment
Share on other sites

  • 0
2 hours ago, Banditul said:

Prostie e sa verifici daca playerid este conectat, dar sa verifici daca x id este conectat este o necesitate(nu in cazul de fata) pentru ca poti avea de a face cu PlayerInfo si daca pasezi INVALID_PLAYER_ID catre PlayerInfo estee posibil sa ai de a face cu Index out of bounds si posibil crash

Este necesar de a face o verificare daca ID este conectat.

Link to comment
Share on other sites

  • 0
Acum 41 minute, RazvaN. a spus:

Este necesar de a face o verificare daca ID este conectat.

... tot ce face linia respectiva este sa vada daca jucatorul pe care il teleportezi la dmv este sau nu conectat... comanda poate functiona perfect doar ca daca nu ar exista id-ul respectiv nu primesti nici un mesaj cum ca "id-ul nu exista".

Si este de ajuns sa lasi doar gPlayerLogged pentru ca o data ce este logat e clar ca este si conectat :)

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

  • 0
2 hours ago, StR_Marian said:

... tot ce face linia respectiva este sa vada daca jucatorul pe care il teleportezi la dmv este sau nu conectat... comanda poate functiona perfect doar ca daca nu ar exista id-ul respectiv nu primesti nici un mesaj cum ca "id-ul nu exista".

Si este de ajuns sa lasi doar gPlayerLogged pentru ca o data ce este logat e clar ca este si conectat :)

Daca nu ai gPlayerLogged[playerid] = 0; la onplayerdisconnect nu e deconectat.

Link to comment
Share on other sites

  • 0
Acum 10 minute, RazvaN. a spus:

Daca nu ai gPlayerLogged[playerid] = 0; la onplayerdisconnect nu e deconectat.

Si de ce nu ai avea =))))))))))))))))))))))))))))))))))))) OMG...

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.