Hey,
ich schon wieder und immer noch das leidige Thema: Mein "Savespot"-Script.
Nun habe ich mich dazu entschlossen an 17 verschiedenen Koordinaten Pickup-Icons auftauchen zu lassen, wenn jemand /savespot eingibt. Und diese dann auch wieder verschwinden zu lassen, wenn der Spieler eines dieser Pickup Icons berührt hat.
Nun mit einem Icon klappt es einwandfrei. Mit mehreren gar nicht. Habs mal mit Arrays versucht, aber das ging nicht. Daher werde ich jetzt einfach mal mein Script hier rein tuen, so wie ich es genutzt habe um ein Pickup Icon zu kreieren.
#include <a_samp>
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Savespot by MrWong");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" SAVESPOT BY MrWong");
print("----------------------------------\n");
}
#endif
forward wweg(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Savespot...testphase");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
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;
}
new P[3];
new SpotX[17] = {585.5973,486.2860,-18.3100,-321.8542,-346.2466,-371.0864,-794.4404,-661.9984,-772.6521,1952.2704,487.0724,-302.1621,-507.9007,563.1576,192.5610,947.3583};
new SpotY[17] = {883.6793,785.2304,933.5237,1138.8214,1295.8824,1547.2622,2253.1462,2463.7505,2306.8774,2422.1487,1343.4623,-91.7136,1786.2516,2376.4365,1322.7494,1391.6954,2180.7637};
new SpotZ[17] = {-44.9682,-22.3725,20.4921,19.3109,53.2294,75.1333,41.9680,117.6694,135.6736,156.6573,15.3746,60.4404,42.3619,71.3119,9.4645,10.1522,10.3664};
new i, Pick0;
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/savespot", cmdtext, true, 10) == 0)
{
Pick0 = CreatePickup(1277,19,585.5973,883.6793,-44.9682);
SendClientMessage (playerid, 0xFF0000FF,"Bewege dich nun zu einem der Savepoints");
SendClientMessage (playerid, 0xFF0000FF,"und gebe danach erneut /savespot ein!");
}
return 0;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid==Pick0)
{
GetPlayerPos(playerid,P[0],P[1],P[2]);
SetPlayerCheckpoint(playerid,585.5973,883.6793,-44.9682);
SendClientMessage(playerid, 0xFF9900FF, "Bleibe innerhalb der Markierung!");
new Zeit,Wanteds;
Wanteds=GetPlayerWantedLevel(playerid);
Zeit=(Wanteds*80000);
SendClientMessage(playerid,0xFF0000FF,"Bitte warte nun !");
SetTimerEx("wweg", Zeit, false, "i", playerid);
GetPlayerPos(playerid,P[0],P[1],P[2]);
PlayerPlaySound(playerid,1062,P[0],P[1],P[2]);
}
return 1;
}
public wweg(playerid)
{
if (PlayerToPoint(10.0, playerid,585.5973,883.6793,-44.9682))
{
DestroyPickup(Pick0);
SetPlayerWantedLevel(playerid, 0);
DisablePlayerCheckpoint(playerid);
PlayerPlaySound(playerid, 1058, P[0],P[1],P[2]);
PlayerPlaySound(playerid,1063,P[0],P[1],P[2]);
SendClientMessage(playerid, 0xFFFF00FF, "Werd jetz nicht sentimental, aber du bist Frei!");
SendClientMessage(playerid, 0xFFFF00FF, "Bedank dich das nächste mal bei MrWong ...");
}
else
{
SendClientMessage(playerid,0xFFFF00FF, "Du hast das Versteck verlassen.");
SendClientMessage(playerid,0xFFFF00FF, "Bitte suche dir schnell ein Neues.");
SendClientMessage(playerid,0xFFFF00FF, "Oder haben die dich etwa schon geschnappt? xD");
PlayerPlaySound(playerid, 1058, P[0],P[1],P[2]);
PlayerPlaySound(playerid,1063,P[0],P[1],P[2]);
}
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;
}
SpotX,SpotY,SpotZ sind die jeweiligen X,Y und Z Koords immer passend : SpotX[0]&SpotY[0]&SpotZ[0]=XYZ-Koords für das erste Icon...
the
MrWong
P.s.: Pls help ich verzweifle noch