[ SCRIPTING ] Tutorial zu beweglichen Toren/Gates
Hallo erstmal,
wollte mir n gate einbauen, habs dann nach diesem TuT (oben) versucht.beim compilen kommt zwar kein error aber iwie is kein gate im spiel. nach langem selber ausprobieren kam ich dann zum entschluss hier einen thread zu schreiben
Das is das script:
#include <a_samp>
#define COLOR_YELLOW 0xFFFF00AA
new y_gate;
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT#pragma tabsize 0
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("-");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print("Test");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Was solln mir machen??");
AddPlayerClass(287,-688.2386,933.8670,13.6328,359.7609,0,0,0,0,0,0); //
[...]
y_gate = CreateObject(969, -705.351624, 951.707703, 11.587727, 0.0000, 0.0000, 270.0000);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)//Das passiert wenn jemand den Server verlässt
{
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid, 31, 9999);//M4, 9999 Schuss
GivePlayerWeapon(playerid, 16, 9999);
GivePlayerWeapon(playerid, 24, 9999);
GivePlayerWeapon(playerid, 27, 9999);
GivePlayerWeapon(playerid, 29, 9999);
GivePlayerWeapon(playerid, 31, 9999);
GivePlayerWeapon(playerid, 37, 9999);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/auf", true) == 0){
MoveObject(y_gate,-705.402466, 960.283386, 11.589193,0);
SendClientMessage(playerid, COLOR_YELLOW,"ACHTUNG: ka!");
return 1;
}
if (strcmp(cmdtext, "/zu", true) == 0){
MoveObject(y_gate,-705.351624, 951.707703, 11.587727,0);
SendClientMessage(playerid, COLOR_YELLOW,"ACHTUNG: weiß net!");
return 1;
}
return 0;
}
[...]
public OnPlayerExitedMenu(playerid)
{
return 1;
}
stock strget(strx[], pos, search = ' ') {
new arg, ret[128], idxx;
for (new i = 0; i < strlen(strx); i++) {
if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
arg++;
if (arg == pos + 1){
ret[i-idxx] = EOS;
return ret;
} else if (arg == pos)
idxx= i+1;
}
else if (arg == pos)
ret[i - idxx] = strx[i];
}
return ret;
}