Digger. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Digger. (
/showthread.php?tid=610380)
Digger. -
Owen007 - 23.06.2016
Can someone give me a clue to make a digger perk for zombie.
i mean that if zombie using digger then teleport zombie to nearest survivour only one time and then after 2 min he can again use that perk.
plz someone help a little bit.
Re: Digger. -
Owen007 - 23.06.2016
can anyone help?
Re: Digger. -
Stinged - 23.06.2016
Wait 24 hours before bumping.
Re: Digger. -
iGetty - 23.06.2016
pawn Код:
new lastTPTime[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
lastTPTime[playerid] = 0;
return 1;
}
CMD:tp(playerid, params[])
{
if(!IsZombieDigger(playerid))return SendClientMessage(playerid, -1, "You're not the required class of Zombie to do this.");
if(gettime() < lastTPTime[playerid])return SendClientMessage(playerid, -1, "You can't TP yet.");
new id, Float:x, Float:y, Float:z;
if(sscanf(params, "u", id))return SendClientMessage(playerid, -1, "Usage: /tp [playerid/name] - This will TP you to a human.");
{
if(!IsPlayerConnected(id))return SendClientMessage(playerid, -1, "That player isn't connected.");
if(!IsHuman(id))return SendClientMessage(playerid, -1, "That player isn't a Human.");
GetPlayerPos(id, x, y, z);
SetPlayerPos(playerid, x, y-2.0, z);
SendClientMessage(playerid, -1, "You have teleported to a human!");
lastTPTime[playerid] = (gettime() + 120);
}
return 1;
}
Here's what you asked for: "i mean that if zombie using digger then teleport zombie to nearest survivour only one time and then after 2 min he can again use that perk."
It's not to the nearest player, but to a player of choice. A bit of research can get the closest player ID.
Re: Digger. -
Owen007 - 23.06.2016
Quote:
Originally Posted by iGetty
pawn Код:
new lastTPTime[MAX_PLAYERS];
public OnPlayerConnect(playerid) { lastTPTime[playerid] = 0; return 1; }
CMD:tp(playerid, params[]) { if(!IsZombieDigger(playerid))return SendClientMessage(playerid, -1, "You're not the required class of Zombie to do this."); if(gettime() < lastTPTime[playerid])return SendClientMessage(playerid, -1, "You can't TP yet."); new id, Float:x, Float:y, Float:z; if(sscanf(params, "u", id))return SendClientMessage(playerid, -1, "Usage: /tp [playerid/name] - This will TP you to a human."); { if(!IsPlayerConnected(id))return SendClientMessage(playerid, -1, "That player isn't connected."); if(!IsHuman(id))return SendClientMessage(playerid, -1, "That player isn't a Human."); GetPlayerPos(id, x, y, z); SetPlayerPos(playerid, x, y-2.0, z); SendClientMessage(playerid, -1, "You have teleported to a human!"); lastTPTime[playerid] = (gettime() + 120); } return 1; }
Here's what you asked for: "i mean that if zombie using digger then teleport zombie to nearest survivour only one time and then after 2 min he can again use that perk."
It's not to the nearest player, but to a player of choice. A bit of research can get the closest player ID.
|
bro i edited this code a lill but not working.
Quote:
if(strcmp("/dig",cmdtext,true,10)==0) {
if(gTeam[playerid] == TEAM_ZOMBIE)
if(gettime() < lastTPTime[playerid])return SendClientMessage(playerid, -1, "You can't dig right now.");
new id, Float, Float:y, Float:z;
if(sscanf(cmdtext, "u", id))return SendClientMessage(playerid, -1, "Usage: /dig [playerid/name] - This will dig you to a human.");
{
if(!IsPlayerConnected(id))return SendClientMessage(playerid, -1, "That player isn't connected.");
if(gTeam[playerid] == TEAM_HUMAN)
SendClientMessage(playerid, -1, "That player isn't a Human.");
GetPlayerPos(id, x, y, z);
SetPlayerPos(playerid, x, y-2.0, z);
SendClientMessage(playerid, -1, "You have teleported to a human!");
lastTPTime[playerid] = (gettime() + 180);
}
return 1;
}
|