Hallo,
ich habe versucht eine schranke einzubauen . Die Datei hab ich jetzt auf den server geladen aber jetzt ist keine Schranke da.
Könnte mir da villeicht weiterhelfen? Danke im vorraus
#include <a_samp>
#include <MidoStream>
#define KEY_HORN 2
#define FILTERSCRIPT
#if defined FILTERSCRIPT
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
new Schranke;
new Schranke_Open;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Schranke");
print("--------------------------------------\n");
Schranke = CreateStreamObject(968, 2238.219238, 2450.509033, 10.647423, 0.0000, 269.7592, 270.0000, 500);
Schranke_Open = 0;
return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
public OnFilterScriptExit()
{
DestroyStreamObject(Schranke);
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/movetor", true) == 0)
{
new playername15[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername15, sizeof(playername15));
if(strcmp("BBC", playername15, true) == 0 )
{
if(PlayerToPoint(30.0, playerid, 2238.219238, 2450.509033, 10.647423))
{
if(Schranke_Open == 0)
{
SetObjectRot(Schranke,-1.570796, -0.000001, 0.000000);
Schranke_Open = 1;
}
else if(Schranke_Open == 1)
{
SetObjectRot(Schranke,-1.570796, -1.574999, 0.000000);
Schranke_Open = 0;
}
}
}
return 1;
}
return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_HORN && IsPlayerInAnyVehicle(playerid))
{
new playername15[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername15, sizeof(playername15));
if(strcmp("BBC", playername15, true) == 0 )
{
if(PlayerToPoint(30.0, playerid, 2238.219238, 2450.509033, 10.647423))
{
if(Schranke_Open == 0)
{
SetObjectRot(Schranke,-1.570796, -0.000001, 0.000000);
Schranke_Open = 1;
}
else if(Schranke_Open == 1)
{
SetObjectRot(Schranke,-1.570796, -1.574999, 0.000000);
Schranke_Open = 0;
}
}
}
}
return 0;
}
#endif