Die Virtuelle Welt wird in Samp nach SpielerTot auf 0 gesetzt, abhilfe schafft hierbei ein SpielerArray bzw. ein PVar, hier ein Beispiel:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128];
if(!strcmp(cmdtext,"/myworld",false,strfind(cmdtext," ",false)))
{
strdel(cmdtext,0,strfind(cmdtext," ",false)+1);
new world = strval(cmdtext);
SetPlayerVirtualWorld(playerid,world);
SetPVarInt(playerid,"PlayerWorld",world);
format(string,sizeof(string),"* Du hast deine Welt auf %d gesetzt...",world);
return SendClientMessage(playerid,0x000000FF,string);
}
return 0;
}
public OnPlayerSpawn(playerid)
{
SetPlayerVirtualWorld(playerid,GetPVarInt(playerid,"PlayerWorld")); //<-- Setzt die Spieler-Welt
PlayerPlaySound(playerid, 1036, 0.0, 0.0, 0.0);
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"%s.savgame",pname);
//ResetPlayerWeapons(playerid);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
if(gTeam[playerid] == 0 || IsAMafia(playerid))
{
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 24, 50);
GivePlayerWeapon(playerid, 25, 50);
GivePlayerWeapon(playerid, 30, 450);
SetPlayerColor(playerid, COLOR_RED);
if(GetPlayerVirtualWorld(playerid)==1)
{
SetPlayerPos(playerid, 2201.2527,-1143.9147,1029.7969);
SetPlayerInterior(playerid, 15);
}
else if(GetPlayerVirtualWorld(playerid)==2)
{
SetPlayerPos(playerid, 1264.6923,-773.4435,1091.9063);
SetPlayerInterior(playerid, 5);
}
else if(GetPlayerVirtualWorld(playerid)==3)
{
SetPlayerPos(playerid, 2235.8574,1678.7686,1008.3594);
SetPlayerInterior(playerid, 1);
}
}
if(gTeam[playerid] == 1 || IsAFBI(playerid))
{
GivePlayerWeapon(playerid, 41, 500);
GivePlayerWeapon(playerid, 23, 300);
GivePlayerWeapon(playerid, 27, 100);
GivePlayerWeapon(playerid, 31, 450);
SetPlayerColor(playerid, COLOR_MAFIA);
if(GetPlayerVirtualWorld(playerid)==1)
{
SetPlayerPos(playerid, 2220.8381,-1153.0044,1025.7969);
SetPlayerInterior(playerid, 15);
}
else if(GetPlayerVirtualWorld(playerid)==2)
{
SetPlayerPos(playerid, 1301.5267,-791.6212,1084.0149);
SetPlayerInterior(playerid, 5);
}
else if(GetPlayerVirtualWorld(playerid)==3)
{
SetPlayerPos(playerid, 2152.2529,1600.2825,1006.1741);
SetPlayerInterior(playerid, 1);
}
}
return 1;
}