so jetzt habe ich mal paar ideen zusammen gefasst.
aber so richtig klappen tut das nicht.
Deklaration:
new indm[MAX_PLAYERS];
Comand Script:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
if(SpielerImGebiet(playerid,3938.0364,-2359.5403,3767.1995,-2859.7549))
{
cmd = strtok(cmdtext, idx);
if (strcmp(cmdtext, "/dmoff", true)==0)
{
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
indm[playerid] = 0;
return 1;
}
//code der nur im dm1 benutzt werden darf
}
else
{
cmd = strtok(cmdtext, idx);
//code der auserhalb vom dm1 benutzt wird
if (strcmp (cmd, "/dm1", true) == 0)
{
SetPlayerPos (playerid,3937.511,-2651.402,56.542);
GivePlayerWeapon(playerid, 34, 1000);
GivePlayerWeapon(playerid, 30, 600);
GivePlayerWeapon(playerid, 29, 600);
GivePlayerWeapon(playerid, 31, 600);
GivePlayerWeapon(playerid, 28, 600);
GivePlayerWeapon(playerid, 32, 600);
GivePlayerWeapon(playerid, 26, 500);
indm[playerid] = 1;
new nametele[MAX_PLAYER_NAME];
new string1[48];
GetPlayerName(playerid, nametele, sizeof(nametele));
format(string1, sizeof(string1), "%s ist zu /dm1 gegangen.", nametele );
SendClientMessageToAll(0xAA3333AA, string1);
return 1;
}
}
return 1;
}
OnPlayerSpawn Funktion:
public OnPlayerSpawn(playerid)
{
if(indm[playerid] == 1 )
{
SetPlayerPos (playerid,3937.511,-2651.402,56.542);
GivePlayerWeapon(playerid, 34, 1000);
GivePlayerWeapon(playerid, 30, 600);
GivePlayerWeapon(playerid, 29, 600);
GivePlayerWeapon(playerid, 31, 600);
GivePlayerWeapon(playerid, 28, 600);
GivePlayerWeapon(playerid, 32, 600);
GivePlayerWeapon(playerid, 26, 500);
SetPlayerWeather(playerid,10);
SetPlayerInterior(playerid,0);
}
else
{
SetPlayerWeather(playerid,10);
SetPlayerInterior(playerid,0);
}
return 1;
}
OnPlayerdeath Funktion:
public OnPlayerDeath(playerid, killerid, reason)
{
if(indm[playerid] == 1)
{
}
else
{
new playercash;
if(killerid == INVALID_PLAYER_ID) {
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
GivePlayerMoney(playerid, - 200);
}
else {
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
playercash = GetPlayerMoney(playerid);
if (playercash > 0) {
GivePlayerMoney(killerid, 200);
GivePlayerMoney(playerid, - 200);
}
}
}
return 1;
}
If spielerimgebiet funktion
SpielerImGebiet(playerid,Float:minimal_x,Float:minimal_y,Float:maximal_x,Float:maximal_y){
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(x >= minimal_x && x <= maximal_x && y >= minimal_y && y <= maximal_y)
{
return 1;
}
return 0;
}
Dann noch:
public OnPlayerUpdate(playerid)
{
if(SpielerImGebiet(playerid,3938.0364,-2359.5403,3767.1995,-2859.7549))
{
indm[playerid] = 0;
}
return 1;
}
frage wo liegt der fehler