Jump to content

[REZOLVAT] Sleep in apartament


equin0x
 Share

Recommended Posts

cmd:sleep(playerid, params[]) {

if(PlayerInfo[playerid][pWantedLevel] != 0) return SendClientMessage(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu poti dormi deoarece esti cautat de politie.");

 

if(InHouse[playerid] != PlayerInfo[playerid][pHouse] && SpawnChange[playerid] == 1) return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai rent in aceasta casa!");

 

if(SpawnChange[playerid] == 2) {

if(have_apartament(playerid) != -1) {

new id = have_apartament(playerid);

if(!PlayerToPoint(50.0, playerid, apartamentInfo[id][apPos][0]+2, apartamentInfo[id][apPos][1], apartamentInfo[id][apPos][2])) return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai spawn la apartament!");

}

else return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai spawn la apartament! (/spawnchanage)");

}

 

if(PlayerInfo[playerid][pSleeping] == 0) {

PlayerInfo[playerid][pSleeping] = 1;

TogglePlayerControllable(playerid,0);

SendClientMessage(playerid, COLOR_LGREEN, "Acum dormi!");

SCM(playerid, COLOR_LGREEN, "Recomandare: Daca doresti sa lasi jocul in bara, iti recomandam sa apesi intai tasta ESC pentru a nu aparea probleme.");

LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);

SetPlayerHealthEx(playerid, 99);

SetPlayerColor(playerid, COLOR_GREY);

Freezed[playerid] = 1;

UpdateVar(playerid, "Status", 2);

if(OnDuty[playerid] == 1) SetPlayerSkinEx(playerid, 305);

OnDuty[playerid] = 0;

SetPlayerArmourEx(playerid, 0);

ResetWeapons(playerid);

 

NearWanted[playerid] = 0;

PlayerTextDrawHide(playerid, NearTD);

tazer[playerid] = 0;

}

else if(PlayerInfo[playerid][pSleeping] == 1) {

PlayerInfo[playerid][pSleeping] = 0;

TogglePlayerControllable(playerid,1);

ClearAnimations(playerid);

SendClientMessage(playerid, COLOR_LGREEN, "Bine ai revenit!");

SetPlayerToTeamColor(playerid);

SetPlayerHealthEx(playerid, 99);

Freezed[playerid] = 0;

UpdateVar(playerid, "Status", 1);

}

return 1;

}

Edited by NoManPv
Link to comment
Share on other sites

 

cmd:sleep(playerid, params[]) {
if(PlayerInfo[playerid][pWantedLevel] != 0) return SendClientMessage(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu poti dormi deoarece esti cautat de politie.");
 
if(InHouse[playerid] != PlayerInfo[playerid][pHouse] && SpawnChange[playerid] == 1) return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai rent in aceasta casa!");
 
if(SpawnChange[playerid] == 2) {
if(have_apartament(playerid) != -1) {
new id = have_apartament(playerid);
if(!PlayerToPoint(50.0, playerid, apartamentInfo[id][apPos][0]+2, apartamentInfo[id][apPos][1], apartamentInfo[id][apPos][2])) return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai spawn la apartament!");
}
else return SCM(playerid, COLOR_WARNING, "[ERROR] {FFFFFF}Nu ai spawn la apartament! (/spawnchanage)");
}
 
if(PlayerInfo[playerid][pSleeping] == 0) {
PlayerInfo[playerid][pSleeping] = 1;
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid, COLOR_LGREEN, "Acum dormi!");
SCM(playerid, COLOR_LGREEN, "Recomandare: Daca doresti sa lasi jocul in bara, iti recomandam sa apesi intai tasta ESC pentru a nu aparea probleme.");
LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
SetPlayerHealthEx(playerid, 99);
SetPlayerColor(playerid, COLOR_GREY);
Freezed[playerid] = 1;
UpdateVar(playerid, "Status", 2);
if(OnDuty[playerid] == 1) SetPlayerSkinEx(playerid, 305);
OnDuty[playerid] = 0;
SetPlayerArmourEx(playerid, 0);
ResetWeapons(playerid);
 
NearWanted[playerid] = 0;
PlayerTextDrawHide(playerid, NearTD);
tazer[playerid] = 0;
}
else if(PlayerInfo[playerid][pSleeping] == 1) {
PlayerInfo[playerid][pSleeping] = 0;
TogglePlayerControllable(playerid,1);
ClearAnimations(playerid);
SendClientMessage(playerid, COLOR_LGREEN, "Bine ai revenit!");
SetPlayerToTeamColor(playerid);
SetPlayerHealthEx(playerid, 99);
Freezed[playerid] = 0;
UpdateVar(playerid, "Status", 1);
}
return 1;
}

 

primesc erori multe

Link to comment
Share on other sites

  • Administrator

Depinde si cum ai facut sistemul de apartamente.

 

Poti crea o variabila gen

new playerInApp[ MAX_PLAYERS ];

iar cu aceasta sa verifici daca id-ul apartamentului este egal cu id-ul virtualworld-ului jucatorului, daca aceasta este identic, inseamna ca jucatorul se afla in apartamentul respectiv, si de aici poti face si singur chestia cu [/sleep].

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...