GTA Közösség - A magyar GTA fórum
San Andreas Multiplayer (SA-MP) => Szkript kérések => SA-MP: Szerverfejlesztés => RP/RPG kérések => A témát indította: sajna - 2011. november 01. - 10:45:25
-
Hello!csináltam egy minigamet,és azt szeretném kérni tõletek,hogy ha valaki letudná nekem irni azt hogy hogyan csináljam meg azt,hogy ha egy játékos a vízbe esik az automatikusan kiesik és felkerül egy adott nézõ helyre,tudom a falloutbol kilehetne szedni ami kelene de próbáltam de nemmegy:( kérlek segítsetek aki letudná nekem irni anak nagyon megköszöném ^-^
-
Lekéred a játékosnak a Z pozícióját:
[pawn]
new FLoat:Z;
GetPlayerPos(playerid,-1,-1,Z);[/pawn]
és ha kisebb 0-nál azt csinálsz vele amit akarsz
[pawn]if(Z < 0)//mivel 0 a vízszint
{
//ide a cuccost
}[/pawn]
-
[pawn]
#include <a_samp>
#define FILTERSCRIPT
//These are the coordinates your player will spawn at if they are still alive at the end of a minigame:
#define spawnX 1310.000000
#define spawnY -1370.199951
#define spawnZ 13.500000
new playerinminigame[MAX_PLAYERS];
new bloodring[15],derbyon,derbyplaying,playercarid[MAX_PLAYERS],playerinderby[MAX_PLAYERS],derbyrank,reward,bloodringfull[15],playerinbloodring[MAX_PLAYERS];
new startvar[8];
//Timers:
new dtimer;
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward load();
forward Spawnbloodrings();// DD1
forward Destroybloodrings();
forward Respawnbloodrings();
forward StartDerby();
forward RewardCalc(playerid,min,max);// General reward calc.
// DD1 kocsik:
new Float:derbycars[15][4] = {
{2885.1626,-3226.0164,9.9285,180.3320}, // 0
{2875.6934,-3219.4521,9.9285,92.2845}, // 1
{2853.6577,-3218.7629,9.9285,179.0787}, // 2
{2816.7488,-3222.4155,9.9285,176.2587}, // 3
{2777.0610,-3221.3945,9.9285,180.9921}, // 4
{2779.5964,-3255.4939,9.9285,270.5963}, // 5
{2777.0886,-3299.5415,9.9285,274.0429}, // 6
{2778.8601,-3330.7070,9.9285,268.7162}, // 7
{2817.1689,-3331.0635,9.9285,3.3438}, // 8
{2853.9089,-3328.3955,9.9285,3.6571}, // 9
{2884.3979,-3328.0374,9.9285,1.4637}, // 10
{2882.9617,-3299.2942,9.9285,94.5245}, // 11
{2811.5439,-3219.5083,9.9285,86.4908}, // 12
{2808.2354,-3254.9351,9.9285,91.8176}, // 13
{2776.9761,-3277.1514,9.9285,180.7817} // 14
};
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
SetTimer(\"load\",2000,0);
return 1;
}
public OnFilterScriptExit()
{
Destroybloodrings();
return 1;
}
#endif
public OnGameModeInit()
{
SetTimer(\"load\",2000,0);
return 1;
}
public OnGameModeExit()
{
Destroybloodrings();
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
playerinminigame[playerid] = 0; // Checks if a player is in a minigame
playercarid[playerid] = -1; // Car that player currently is in, used to check whether the player is in a derby/race car
playerinderby[playerid] = 0; // Derby
playerinbloodring[playerid] = -1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new string[256];
if(playerinderby[playerid] == 1)
{
new DerbyPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
format(string, sizeof(string), \"%s has been dropped out of the derby, rank: %d\", DerbyPlayerName, derbyrank);
SendClientMessageToAll(0x33AA33AA, string);
playerinderby[playerid] = 0;
playerinminigame[playerid] = 0;
bloodringfull[playerinbloodring[playerid]] = 0;
playerinbloodring[playerid] = -1;
if(derbyrank <= 2)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && playerinderby == 1)
{
new winnername[256];
GetPlayerName(i,winnername, sizeof(winnername));
RewardCalc(i,100,1000);
format(string, sizeof(string), \"%s has won the derby for $%d\", winnername, reward);
SendClientMessageToAll(0x33AA33AA, string);
GivePlayerMoney(i,reward);
playerinderby = 0;
playerinminigame = 0;
SetPlayerVirtualWorld(i,0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(i, spawnX, spawnY, spawnZ);
}
}
derbyplaying = 0;
derbyrank = 0;
derbyon = 0;
KillTimer(dtimer);
Respawnbloodrings();
return 1;
}
derbyrank--;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new string[256];
if(playerinderby[playerid] == 1)
{
new FLoat:Z;
GetPlayerPos(playerid,-1,-1,Z);
if(Z < 0)//mivel 0 a vízszint
{
format( str, sizeof( str ), \"* %s \"COL_RULE\"kiesett a \"COL_ORANGE\"játékból\"COL_LIME\"helyezés %d\", PlayerName( i ), Iter_Count(_Minigamer ) );
SendClientMessageToAll( LIME, str );
GameTextForPlayer( i, pFellOffText[ random( sizeof( pFellOffText ) ) ], 2500, 3 );
Iter_Remove(_Minigamer, i );
Minigamer_{ i } = false;
RespawnPlayer( i );
}
new DerbyPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
format(string, sizeof(string), \"%s kiesett a DD1-böl, Helyezés: %d\", DerbyPlayerName, derbyrank);
SendClientMessageToAll(0x33AA33AA, string);
playerinderby[playerid] = 0;
playerinminigame[playerid] = 0;
bloodringfull[playerinbloodring[playerid]] = 0;
playerinbloodring[playerid] = -1;
if(derbyrank <= 2)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i) && playerinderby == 1)
{
new winnername[256];
GetPlayerName(i,winnername, sizeof(winnername));
RewardCalc(i,100,1000);
format(string, sizeof(string), \"%s nyerte a DD1-et $%d\", winnername, reward);
SendClientMessageToAll(0x33AA33AA, string);
GivePlayerMoney(i,reward);
playerinderby = 0;
playerinminigame = 0;
SetPlayerVirtualWorld(i,0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(i, spawnX, spawnY, spawnZ);
}
}
derbyplaying = 0;
derbyrank = 0;
derbyon = 0;
KillTimer(dtimer);
Respawnbloodrings();
return 1;
}
derbyrank--;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
new string[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, \"/mark\", true) == 0)
{
if(playerinminigame[playerid])
{
SendClientMessage(playerid, 0x33AA33AA, \"A visszaélés elkerülése érdekében, /mark and /gotomark le van tiltva minigame-be.\");
return 1;
}
}
if(strcmp(cmd, \"/gotomark\", true) == 0)
{
if(playerinminigame[playerid])
{
SendClientMessage(playerid, 0x33AA33AA, \"A visszaélés elkerülése érdekében, /mark and /gotomark le van tiltva minigame-be.\");
return 1;
}
}
if(strcmp(cmd, \"/minigames\", true) == 0)
{
SendClientMessage(playerid, 0x33AA33AA, \"______________________________________________________________________________\");
SendClientMessage(playerid, 0xFF0000FF, \" \");
SendClientMessage(playerid, 0xFF0000FF, \"Jelenleg elérhetõ minigamek:\");
SendClientMessage(playerid, 0xFF0000FF, \"/DD1,\");
SendClientMessage(playerid, 0x33AA33AA, \"______________________________________________________________________________\");
return 1;
}
if(strcmp(cmd, \"/dd1\", true) == 0)
{
if(derbyplaying == 1)
{
SendClientMessage(playerid, 0xB4B5B7AA, \"A DD1 már elkezdõdött\");
return 1;
}
if(playerinminigame[playerid] == 1)
{
SendClientMessage(playerid, 0xB4B5B7AA, \"Már játékban vagy!\");
return 1;
}
new pname[256];
GetPlayerName(playerid, pname, 256);
if(derbyon == 0)
{
derbyon = 1;
playerinminigame[playerid] = 1;
playerinderby[playerid] = 1;
derbyrank = 1;
SetPlayerInterior(playerid,15);
SetPlayerVirtualWorld(playerid,7);
SetVehicleVirtualWorld(bloodring[0],7);
bloodringfull[0] = 1;
PutPlayerInVehicle(playerid, bloodring[0], 0);
playerinbloodring[playerid] = 0;
TogglePlayerControllable(playerid, 0);
startvar[0] = 1;
dtimer = SetTimer(\"StartDerby\", 3500, 0);
format(string, sizeof(string), \"%s elkezdõdött a DD1 ha szeretnél csatlakozni ird:/dd1\", pname);//
SendClientMessageToAll(0x33AA33AA,string);
return 1;
} else if(derbyon == 1 && derbyrank < 15) {
playerinminigame[playerid] = 1;
playerinderby[playerid] = 1;
derbyrank++;
SetPlayerInterior(playerid,15);
for(new i=0; i<15; i++)
{
if(bloodringfull == 0)
{
SetPlayerVirtualWorld(playerid,7);
SetVehicleVirtualWorld(bloodring,7);
bloodringfull = 1;
PutPlayerInVehicle(playerid, bloodring, 0);
TogglePlayerControllable(playerid, 0);
playerinbloodring[playerid] = i;
format(string, sizeof(string), \"%s csatlakozott a DD1-hez\", pname);//
SendClientMessageToAll(0x33AA33AA,string);
return 1;
}
}
} else if(derbyon == 1 && derbyrank >= 15) {
format(string, sizeof(string), \"A DD1 tele van,várd meg a következõ menetet!\", pname);//
SendClientMessage(playerid,0x33AA33AA,string);
return 1;
}
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
playercarid[playerid] = GetPlayerVehicleID(playerid);
}
if(oldstate == 2)
{
if(playerinderby[playerid])
{
PutPlayerInVehicle(playerid,playercarid[playerid],0);
}
}
return 1;
}
public Spawnbloodrings()
{
for(new i=0; i<15; i++)
{
bloodring = CreateVehicle(504,derbycars[1],derbycars[2],derbycars[3],-1,-1,-1);
LinkVehicleToInterior(bloodring,15);
SetVehicleVirtualWorld(bloodring,1);
bloodringfull = 0;
}
return 1;
}
public Destroybloodrings()
{
for(new i=0; i<15; i++)
{
DestroyVehicle(bloodring);
bloodringfull = 0;
}
}
public Respawnbloodrings()
{
for(new i=0; i<15; i++)
{
SetVehicleToRespawn(bloodring);
SetVehicleVirtualWorld(bloodring,1);
bloodringfull = 0;
}
}
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 StartDerby()
{
new delay = 1000;
new string[32];
if(startvar[0] == 1)
{
if( derbyrank <= 1 )
{
SendClientMessageToAll(0x33AA33AA, \"DD1 befejezõdött. Oka: Nincs elég játékos. (minimum = 2)\");
derbyplaying = 0;
derbyrank = 0;
derbyon = 0;
startvar[0] = 0;
Respawnbloodrings();
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (playerinderby == 1)
{
playerinderby = 0;
playerinminigame = 0;
playerinbloodring = -1;
SetPlayerVirtualWorld(i,0);
SetPlayerInterior(i, 0);
SetPlayerPos(i, spawnX, spawnY, spawnZ);
TogglePlayerControllable(i, 1);
}
}
}
return 1;
}
format(string, sizeof(string), \"~r~Ready\");
derbyplaying = 1;
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (playerinderby == 3)
{
GameTextForPlayer(i, string, delay, 6);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
startvar[0] = 2;
SetTimer(\"StartDerby\", delay, 0);
} else if(startvar[0] == 2) {
format(string, sizeof(string), \"~r~Set\");
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (playerinderby == 2)
{
GameTextForPlayer(i, string, delay, 6);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
}
}
startvar[0] = 3;
SetTimer(\"StartDerby\", delay, 0);
} else if(startvar[0] == 3) {
format(string, sizeof(string), \"~g~Go!\");
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (playerinderby == 1)
{
GameTextForPlayer(i, string, delay, 6);
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
TogglePlayerControllable(i, 1);
}
}
}
startvar[0] = 0;
}
return 1;
}
public RewardCalc(playerid,min,max)//Originally from PenLS
{
reward = (min + (random(max-min)));
}
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;
}<
-
[pawn]forward OnPlayerPosUpdated(playerid);[/pawn]
[pawn]public OnPlayerConnect(playerid)
{
SetTimerEx(\"OnPlayerPosUpdated\",1000,true,\"i\",playerid);
return 1;
}[/pawn]
[pawn]public OnPlayerPosUpdated(playerid)
{
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2])
if(pos[2] < 0)
{
//ide írd hogy mit csináljon hogyha a víz alatt van
}
return 1;
}[/pawn]
Az OnPlayerDeath alol töröld...
-
Sikerült!Csak anyi lene még a kérdésem hogy nem spawnolja ujra se semi:D csak a vizben van és ujra meg ujra kiirja hogy hanyadik meg hogy kieset!És azt hogytudom emgcsinálni hogy feldobja egy kameranézetbe?és adig várjon mig egy uj kör nemlesz?Elõre is kösz!természetesen megy a +
Dupla hozzászólás automatikusan összefûzve. ( 2011. november 02. - 14:42:36 )
[pawn][/pawn]
public OnPlayerPosUpdated(playerid)
{
new string[256];
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
if(pos[2] < 0)
{
new DerbyPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
format(string, sizeof(string), \"%s has been dropped out of the derby, rank: %d\", DerbyPlayerName, derbyrank);
SendClientMessageToAll(0x33AA33AA, string);
playerinderby[playerid] = 0;
playerinminigame[playerid] = 0;
bloodringfull[playerinbloodring[playerid]] = 0;
playerinbloodring[playerid] = -1;
}
return 1;
}
itvan hogy hogy csináltam!
-
nézd meg ezt, ezt, és ezt. amúgy onplayerconnect alatt ottvannak ezek a funkciók, csak meg kell változtatni a pozíciót..
-
[pawn]#include <a_samp>
stock bool:IsPlayerInWater(playerid)
{
new animlib[32], atmp[32];
GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, sizeof(animlib), atmp, sizeof(atmp));
if( !strcmp(animlib, \"SWIM\") && !IsPlayerInAnyVehicle(playerid) ) return 1;
return 0;
}
public OnPlayerUpdate(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInWater(playerid) || z < 0 || IsPlayerInWater(playerid) && z < 0)
{
//Mi történjen ha vízbe, vagy víz alatt van
}
return 1;
}[/pawn]
-
D:\\Játékok\\Rockstar Games\\minigame.pwn(441) : warning 213: tag mismatch
D:\\Játékok\\Rockstar Games\\minigame.pwn(442) : warning 213: tag mismatch
ezt a két hibát irta ki :(
-
D:\\Játékok\\Rockstar Games\\minigame.pwn(441) : warning 213: tag mismatch
D:\\Játékok\\Rockstar Games\\minigame.pwn(442) : warning 213: tag mismatch
ezt a két hibát irta ki :(
Ez Nem Hiba Csak Warning!
Ettõl még el kell indulnia!
-
másold be azt a két sort. Dead te meg jó lenne hogyha leállnál a posthunterkedéssel....