pawn Код:
public SetPlayerSpawn(playerid)
{
/*new Float:X,
Float:Y,
Float:Z;*/
if(IsPlayerConnected(playerid))
{
new house = Account[playerid][pPhousekey];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
SafeResetPlayerWeapons(playerid);
if(Account[playerid][pTut] == 0)
{
Tutorial1[playerid] = TextDrawCreate(179.000000,357.0000,"000");
TextDrawUseBox(Tutorial1[playerid],1);
TextDrawBoxColor(Tutorial1[playerid],0x00000066);
TextDrawTextSize(Tutorial1[playerid],480.000000,0.000000);
TextDrawAlignment(Tutorial1[playerid],0);
TextDrawBackgroundColor(Tutorial1[playerid],0x000000ff);
TextDrawFont(Tutorial1[playerid],1);
TextDrawLetterSize(Tutorial1[playerid],0.399999,1.000000);
TextDrawColor(Tutorial1[playerid],0xffffffff);
TextDrawSetOutline(Tutorial1[playerid],1);
TextDrawSetProportional(Tutorial1[playerid],1);
TextDrawSetShadow(Tutorial1[playerid],1);
/*Tutorial1[playerid] = TextDrawCreate(179.000000,124.000000,"000");
TextDrawUseBox(Tutorial1[playerid],1);
TextDrawBoxColor(Tutorial1[playerid],0x00000066);
TextDrawTextSize(Tutorial1[playerid],480.000000,0.000000);
TextDrawAlignment(Tutorial1[playerid],0);
TextDrawBackgroundColor(Tutorial1[playerid],0x000000ff);
TextDrawFont(Tutorial1[playerid],1);
TextDrawLetterSize(Tutorial1[playerid],0.399999,1.000000);
TextDrawColor(Tutorial1[playerid],0xffffffff);
TextDrawSetOutline(Tutorial1[playerid],1);
TextDrawSetProportional(Tutorial1[playerid],1);
TextDrawSetShadow(Tutorial1[playerid],1);*/
//371.0000
gOoc[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1;
TogglePlayerControllable(playerid, false);
SetPlayerPos(playerid, 954.6555,-1702.3538,15.3847);
SetPlayerFacingAngle(playerid, 90);
SetPlayerCameraPos(playerid, 922.761718, -1703.137817, 15.237014);
SetPlayerCameraLookAt(playerid, 926.758789, -1702.984741, 15.233889);
/*SetPlayerCameraPos(playerid, 2177.5269,1285.3782,44.0867);
SetPlayerCameraLookAt(playerid, 2182.2908,1285.7317,42.9620);*/
SetPlayerVirtualWorld(playerid,1+random(999));
RegistrationStep[playerid] = 1;
ShowPlayerDialog(playerid,300,DIALOG_STYLE_INPUT,"{0080FF} Sex","{FFFFFF}What is your gender? {0080FF}Male {FFFFFF}or {0080FF}Female ","Proceed","Cancel");
gPlayerLogged[playerid] = 1;
return true;
}
/*if(Account[playerid][pPcarkey1] != 999 || Account[playerid][pPcarkey2] != 999 || Account[playerid][pPcarkey3] != 999)
{
new vehid1 = Account[playerid][pPcarkey1];
new vehid2 = Account[playerid][pPcarkey2];
new vehid3 = Account[playerid][pPcarkey3];
if(Account[playerid][pPcarkey1] != 999)
{
if(strcmp(VehicleInfo[vehid1][cOwner],name, true ) == 0 ) { }
else { vehid1 = 999; }
}
else if(Account[playerid][pPcarkey2] != 999)
{
if(strcmp(VehicleInfo[vehid2][cOwner],name, true ) == 0 ) { }
else { vehid2 = 999; }
}
else if(Account[playerid][pPcarkey3] != 999)
{
if(strcmp(VehicleInfo[vehid3][cOwner],name, true ) == 0 ) { }
else { vehid3 = 999; }
}
}*/
if(Account[playerid][pFMember] == 255 && Account[playerid][pGMember] == 255)
{
if(Account[playerid][pJob] == 10)
{
Account[playerid][pJob] = 0;
}
}
/*for(new c=0;c<sizeof(VehicleInfo);c++)
{
if(strcmp(VehicleInfo[c][cOwner],name, true ) == 0 )
{
if(Account[playerid][pPcarkey1] == 999)
{
Account[playerid][pPcarkey1] = c;
continue;
}
if(Account[playerid][pPcarkey2] == 999)
{
Account[playerid][pPcarkey2] = c;
continue;
}
if(Account[playerid][pPcarkey3] == 999)
{
Account[playerid][pPcarkey3] = c;
break;
}
}
}*/
/*if(house != 255)
{
if(strcmp(Property[house][hOwner],name, true ) == 0 ) { }
else { house = 255; }
}*/
if(Account[playerid][pJailed] == 1)
{
SetPlayerInterior(playerid, 6);
Account[playerid][pInt] = 6;
TogglePlayerControllable(playerid, true);
SetPlayerPos(playerid,264.6288,77.5742,1001.0391);
SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Jail Sentence, back to jail.");
gPlayerLogged[playerid] = 1;
return true;
}
if(Account[playerid][pJailed] == 3)
{
SetPlayerInterior(playerid, 0);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SetPlayerPos(playerid,2525.8032,-1309.8915,1031.4219);
gPlayerLogged[playerid] = 1;
return true;
}
if(Account[playerid][pJailed] == 2)
{
SetPlayerInterior(playerid, 3);
Account[playerid][pInt] = 3;
SetPlayerPos(playerid, 1763.6307,-1540.7831,9.2410);
TogglePlayerControllable(playerid, true);
SendClientMessage(playerid, COLOR_LIGHTRED, "Incomplete Jail Sentence, back to jail.");
gPlayerLogged[playerid] = 1;
return true;
}
if(Hospital[playerid] == 1 && Account[playerid][pJailed] == 0)
{
if(FirstSpawn[playerid] != 1)
{
/*SetPlayerHealth(playerid, 25.0);
SetPlayerInterior(playerid, 0);
Account[playerid][pInt] = 0;
SendClientMessage(playerid, TEAM_CYAN_COLOR, "Doctor: Hope your feeling better, please be aware next time.");
TogglePlayerControllable(playerid, true);
SetPlayerPos(playerid, 1178.1443,-1323.3268,14.1056);
SetPlayerFacingAngle(playerid, 270.9733);
SetCameraBehindPlayer(playerid);
return true;*/
new rand;
SetPlayerPos(playerid, 1160.8542,-1330.8306,1499.4673);
SetPlayerFacingAngle(playerid, 357.6145);
SetPlayerInterior(playerid, 0);
Account[playerid][pInt] = 0;
rand = 1+random(200);
SetPlayerVirtualWorld(playerid,rand);
Account[playerid][pVirtualWorld] = rand;
SetPlayerCameraPos(playerid, 1152.0311,-1325.3153,1498.6328);
SetPlayerCameraLookAt(playerid,1160.3467,-1332.2661,1498.6328);
TogglePlayerControllable(playerid, false);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
MedicTime[playerid] = 1;
//
TextDrawHideForPlayer(playerid,Textdrawz[playerid]);
TextDrawSetString(Textdrawz[playerid],"~w~You are resting due ~r~brutally wounds~w~, you will be out when the doctor says so.~n~ The time in, depends on your 'Death Way'");
//
TextDrawShowForPlayer(playerid,Textdrawz[playerid]);
PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0);
return true;
}
}
if(Account[playerid][pCrashed] == 1)
{
Account[playerid][pLocal] = 255;
TogglePlayerControllable(playerid, true);
SetPlayerVirtualWorld(playerid,Account[playerid][pVirtualWorld]);
SetPlayerInterior(playerid,Account[playerid][pInt]);
Account[playerid][pCrashed] = 0;
TextDrawHideForPlayer(playerid,Textdrawz[playerid]);
if(Account[playerid][pQuitOnCar]==1){
SetPlayerPos(playerid,CrashPos[playerid][0],CrashPos[playerid][1],CrashPos[playerid][2]+4);
Account[playerid][pQuitOnCar]=0; }
else {
SetPlayerPos(playerid,CrashPos[playerid][0],CrashPos[playerid][1],CrashPos[playerid][2]); }
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
OnPlayerUpdate(playerid);
gPlayerLogged[playerid] = 1;
return true;
}
if(house !=255)
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,Property[house][hInt]);
SetPlayerPos(playerid, Property[house][hExitx], Property[house][hExity],Property[house][hExitz]); // Warp the player
Account[playerid][pLocal] = house;
if(IsAtHouse[playerid]==0){IsAtHouse[playerid]=1;}
TogglePlayerControllable(playerid, true);
SetPlayerVirtualWorld(playerid,Property[house][hVirtualWorld]);
Account[playerid][pVirtualWorld] = Property[house][hVirtualWorld];
Account[playerid][pInt] = Property[house][hInt];
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
new renthouse = Account[playerid][pRentKey];
if(renthouse!=255)
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,Property[renthouse][hInt]);
SetPlayerPos(playerid, Property[renthouse][hExitx], Property[renthouse][hExity],Property[renthouse][hExitz]); // Warp the player
Account[playerid][pLocal] = renthouse;
if(IsAtHouse[playerid]==0){IsAtHouse[playerid]=1;}
TogglePlayerControllable(playerid, true);
SetPlayerVirtualWorld(playerid,Property[renthouse][hVirtualWorld]);
Account[playerid][pVirtualWorld] = Property[renthouse][hVirtualWorld];
Account[playerid][pInt] = Property[renthouse][hInt];
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if (Account[playerid][pMember] == 1 || Account[playerid][pLeader] == 1)//Police Force spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 1576.6135,-1694.3019,6.2188); // Warp the player
SetPlayerFacingAngle(playerid, 175.3597);
SetPlayerInterior(playerid,0);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if (Account[playerid][pMember] == 3 || Account[playerid][pLeader] == 3)//National Guard spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1318.9393,1253.1924,10.8203);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if (Account[playerid][pMember] == 4 || Account[playerid][pLeader] == 4)//Fire/Ambulance spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1174.5393,-1322.8113,14.7891);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if (Account[playerid][pMember] == 5 || Account[playerid][pLeader] == 5)//flight
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1893.7687,-2244.4075,13.5469);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
else if (Account[playerid][pMember] == 9 || Account[playerid][pLeader] == 9) //News spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 1409.4679,-1706.0242,13.5469);
SetPlayerInterior(playerid,0);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if (Account[playerid][pMember] == 10 || Account[playerid][pLeader] == 10) //Taxi Cab Company spawn
{
SetPlayerToTeamColor(playerid);
SetPlayerPos(playerid, 2486.2556,-2081.0901,13.5469);
SetPlayerInterior(playerid,0);
Account[playerid][pInt] = 0;
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
if(Account[playerid][pGMember] != 255)
{
new gang2 = Account[playerid][pGMember];
if(GangInfo[gang2][GangTaken] == 0)
{
gang2 = 255;
SetPlayerSpawn(playerid);
return true;
}
else
{
if(GangInfo[gang2][GangSpawn][0] == 0.0 && GangInfo[gang2][GangSpawn][1] == 0.0 && GangInfo[gang2][GangSpawn][2] == 0.0)
{
SetPlayerPos(playerid,1642.4680,-2240.2568,13.4952);
SetPlayerFacingAngle(playerid, 132.5796);
SetPlayerInterior(playerid,0);
TogglePlayerControllable(playerid, true);
Account[playerid][pInt] = 0;
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
else
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid, GangInfo[gang2][GangInterior]);
Account[playerid][pInt] = GangInfo[gang2][GangInterior];
SetPlayerPos(playerid, GangInfo[gang2][GangSpawn][0],GangInfo[gang2][GangSpawn][1],GangInfo[gang2][GangSpawn][2]);
SetPlayerFacingAngle(playerid, GangInfo[gang2][GangSpawn][3]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
}
}
if(Account[playerid][pFMember] != 255)
{
new family = Account[playerid][pFMember];
if(FamilyInfo[family][FamilyTaken] == 0)
{
family = 255;
SetPlayerSpawn(playerid);
return true;
}
else
{
if(FamilyInfo[family][FamilySpawn][0] == 0.0 && FamilyInfo[family][FamilySpawn][1] == 0.0 && FamilyInfo[family][FamilySpawn][2] == 0.0)
{
SetPlayerPos(playerid,1642.4680,-2240.2568,13.4952);
SetPlayerFacingAngle(playerid, 132.5796);
SetPlayerInterior(playerid,0);
TogglePlayerControllable(playerid, true);
Account[playerid][pInt] = 0;
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
else
{
TogglePlayerControllable(playerid, true);
SetPlayerToTeamColor(playerid);
Account[playerid][pInt] = FamilyInfo[family][FamilyInterior];
SetPlayerInterior(playerid, FamilyInfo[family][FamilyInterior]);
SetPlayerPos(playerid, FamilyInfo[family][FamilySpawn][0],FamilyInfo[family][FamilySpawn][1],FamilyInfo[family][FamilySpawn][2]);
SetPlayerFacingAngle(playerid, FamilyInfo[family][FamilySpawn][3]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
}
}
else
{
if(CrashPos[playerid][0] == 0.0 && CrashPos[playerid][1] == 0.0)
{
SetPlayerPos(playerid,1642.4680,-2240.2568,13.4952);
SetPlayerFacingAngle(playerid, 132.5796);
}
else
{
if(Account[playerid][pQuitOnCar]==1){
SetPlayerPos(playerid,CrashPos[playerid][0],CrashPos[playerid][1],CrashPos[playerid][2]+4);
Account[playerid][pQuitOnCar]=0; }
else {
SetPlayerPos(playerid,CrashPos[playerid][0],CrashPos[playerid][1],CrashPos[playerid][2]); }
}
//SetPlayerPos(playerid,1642.4680,-2240.2568,13.4952);
//SetPlayerFacingAngle(playerid, 132.5796);
SetPlayerInterior(playerid,Account[playerid][pInt]);
TogglePlayerControllable(playerid, true);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun0], Account[playerid][pAmmo0]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun1], Account[playerid][pAmmo1]);
SafeGivePlayerWeapon(playerid, Account[playerid][pGun2], Account[playerid][pAmmo2]);
gPlayerLogged[playerid] = 1;
return true;
}
}
return true;
}
When A player die, Instead of spawning him at the hospital, he spaws at his house,, I tried Puting what's in SetPlayerSpawn In OnPlayerSpawn, But didn't work, any help ?
Your like here's this here's that..
Organize your code and use a switch & case statement in OnPlayerDeath callback, otherwise no one gonna help you, cause your code is messy.