if(strcmp(cmd,"/cativeiro",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_123,"USE: /cativeiro [Id] [tempo");
return true;
}
new org = GetPlayerOrg(playerid);
new para1;
new time;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext,idx);
time = strval(tmp);
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
if(ProxDetectorS(3.0,playerid,giveplayerid))
{
if(PlayerInfo[para1][pMembro] == 6||PlayerInfo[para1][pLider] == 6)
{
SendClientMessage(playerid,COLOR_GRAD1,"Vocк nгo pode prender um terrorista no cativeiro.");
return true;
}
GetPlayerName(para1,giveplayer,sizeof(giveplayer));
GetPlayerName(playerid,sendername,sizeof(sendername));
if ((org == 6) && PlayerToPoint(2.0, playerid,-1104.1871,-1666.2097,76.4672))
{
ProxDetector(30.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[para1][pJailed] = 4;
PlayerInfo[para1][pJailTime] = time*60;
PlayerInfo[para1][pPnumber] = 0;
Telefoneoff[para1] = 1;
ResetPlayerWeapons(para1);
SetPlayerPos(para1,-1104.1200,-1664.0133,76.4672);
SetCameraBehindPlayer(para1);
}
return true;
}
else
{
SendClientMessage(playerid,COLOR_GRAD1," Vocк nгo esta proximo ao cara.");
}
}
}
}
CMD:boombox(playerid, params[])
{
new string[128];
if(!GetPVarType(playerid, "BoomboxObject"))
{
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
foreach(Player, i)
{
if(GetPVarType(i, "BoomboxObject"))
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ")))
{
SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
return 1;
}
}
}
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "bposX", x); SetPVarFloat(playerid, "bposY", y); SetPVarFloat(playerid, "bposZ", z);
SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
format(string, sizeof(string), " You have placed your boombox at your location.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
}
}
SetPVarString(playerid, "BoomboxURL", params);
}
else
{
DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ");
if(GetPVarType(playerid, "bboxareaid"))
{
foreach(Player,i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
StopAudioStreamForPlayer(i);
SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
}
}
DeletePVar(playerid, "bboxareaid");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have removed your boombox.");
}
CMD:vida(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, -1, "Use: /vida [id]");
if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, -1, "Jogador nгo conectado.");
SetPlayerHealth(strval(params), 100.0);
return 1;
}
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
if (strcmp(cmd, "/boombox", true) == 0)
{
if (IsPlayerConnected(playerid))
{
new string[128];
if (!GetPVarType(playerid, "BoomboxObject"))
{
if (sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
foreach(Player, i)
{
if (GetPVarType(i, "BoomboxObject"))
{
if (IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ")))
{
SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
return 1;
}
}
}
new Float: x,
Float: y,
Float: z,
Float: a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "bposX", x);
SetPVarFloat(playerid, "bposY", y);
SetPVarFloat(playerid, "bposZ", z);
SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
format(string, sizeof(string), " You have placed your boombox at your location.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
foreach(Player, i)
{
if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
}
}
SetPVarString(playerid, "BoomboxURL", params);
}
else
{
DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
DeletePVar(playerid, "BoomboxObject");
DeletePVar(playerid, "BoomboxURL");
DeletePVar(playerid, "bposX");
DeletePVar(playerid, "bposY");
DeletePVar(playerid, "bposZ");
if (GetPVarType(playerid, "bboxareaid"))
{
foreach(Player, i)
{
if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
StopAudioStreamForPlayer(i);
SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
}
}
DeletePVar(playerid, "bboxareaid");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have removed your boombox.");
}
}
return 1;
}
new cmd[50 char], params[100 char];
unformat(cmdtext, "s[50]S( )[100]",cmd,params);
if(strcmp(cmd, "/vida", true) == 0)
{
new id[128] = strtok(cmdtext, idx);
if(!strlen(id)) return SendClientMessage(playerid, -1, "/vida [id]");
SetPlayerHealth(strval(id), 100.0);
return 1;
}
// Separar o comando dos parвmetros:
if(strcmp(cmd, "/vida", true) == 0)
{
new cmd[30], id;
// cmd irб armazenar o comadando. Ex: se eu digitar /vida 0 , o /vida vai ficar armazenado dentro da string cmd.
// o id irб armazenar o id do jogador escolhido, se eu digitar /vida 10 , o 10 vai ficar armazenado na variбvel.
if(sscanf(cmdtext, "s[30]u", cmd, id)) return SendClientMessage(playerid, -1, "/vida [id]");
SetPlayerHealth(id, 100.0);
return 1;
}
CMD:cativeiro(playerid, params[])
{
new idplayer, tempo;
new org = GetPlayerOrg(playerid);
if(sscanf(params, "id", idplayer, tempo)) return SendClientMessage(playerid,-1,"USE: /cativeiro [Id] [tempo");
if(!IsPlayerConnected(idplayer)) return SendClientMessage(playerid, -1, "[ ERRO ] Este player nгo estб conectado!");
if(ProxDetectorS(3.0,playerid,idplayer))
{
if(PlayerInfo[idplayer][pMembro] == 6||PlayerInfo[idplayer][pLider] == 6) return SendClientMessage(playerid,COLOR_GRAD1,"Vocк nгo pode prender um terrorista no cativeiro.");
if((org == 6) && PlayerToPoint(2.0, playerid,-1104.1871,-1666.2097,76.4672))
ProxDetector(30.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[idplayer][pJailed] = 4;
PlayerInfo[idplayer][pJailTime] = tempo*60;
PlayerInfo[idplayer][pPnumber] = 0;
Telefoneoff[idplayer] = 1;
ResetPlayerWeapons(idplayer);
SetPlayerPos(idplayer,-1104.1200,-1664.0133,76.4672);
SetCameraBehindPlayer(idplayer);
return true;
}
else
{
SendClientMessage(playerid,COLOR_GRAD1," Vocк nгo esta proximo ao cara.");
}
return 1;
}
Comando pronto abaixo, se funcionar avisa aqui no tуpico. Espero ter ajudado!
PHP код:
|
if (strcmp(cmd, "/boombox", true) == 0)
{
if (IsPlayerConnected(playerid))
{
new string[128];
if (!GetPVarType(playerid, "BoomboxObject"))
{
if (sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
foreach(Player, i)
{
if (GetPVarType(i, "BoomboxObject"))
{
if (IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ")))
{
SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
return 1;
}
}
}
new Float: x,
Float: y,
Float: z,
Float: a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "bposX", x);
SetPVarFloat(playerid, "bposY", y);
SetPVarFloat(playerid, "bposZ", z);
SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
format(string, sizeof(string), " You have placed your boombox at your location.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
foreach(Player, i)
{
if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
}
}
SetPVarString(playerid, "BoomboxURL", params);
}
else
{
DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
DeletePVar(playerid, "BoomboxObject");
DeletePVar(playerid, "BoomboxURL");
DeletePVar(playerid, "bposX");
DeletePVar(playerid, "bposY");
DeletePVar(playerid, "bposZ");
if (GetPVarType(playerid, "bboxareaid"))
{
foreach(Player, i)
{
if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
StopAudioStreamForPlayer(i);
SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
}
}
DeletePVar(playerid, "bboxareaid");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have removed your boombox.");
}
}
return 1;
CMD:boomboxnext(playerid, params[])
{
if(!Boombox[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You don't have a boombox placed.");
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boomboxnext [music url]");
SendClientMessage(playerid, COLOR_GREY, " You have changed the music your boombox is playing.");
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
}
}
SetPVarString(playerid, "BoomboxURL", params);
return 1;
}
CMD:boombox(playerid, params[])
{
new string[256];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "[ ERRO ] Vocк nгo estб conectado no servidor!");
if(!GetPVarType(playerid, "BoomboxObject"))
{
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "USAGE: /boombox [music url]");
foreach(Player, i)
{
if(GetPVarType(i, "BoomboxObject"))
{
if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "bposX"), GetPVarFloat(i, "bposY"), GetPVarFloat(i, "bposZ"))) return SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
new Float: x, Float: y, Float: z, Float: a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
SetPVarInt(playerid, "BoomboxObject", CreateDynamicObject(2103, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
SetPVarFloat(playerid, "bposX", x);
SetPVarFloat(playerid, "bposY", y);
SetPVarFloat(playerid, "bposZ", z);
SetPVarInt(playerid, "bboxareaid", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
format(string, sizeof(string), " You have placed your boombox at your location.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid"))) PlayAudioStreamForPlayer(i, params, GetPVarFloat(playerid, "bposX"), GetPVarFloat(playerid, "bposY"), GetPVarFloat(playerid, "bposZ"), 30.0, 1);
}
SetPVarString(playerid, "BoomboxURL", params);
}
else
{
DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
DeletePVar(playerid, "BoomboxObject");
DeletePVar(playerid, "BoomboxURL");
DeletePVar(playerid, "bposX");
DeletePVar(playerid, "bposY");
DeletePVar(playerid, "bposZ");
if(GetPVarType(playerid, "bboxareaid"))
{
foreach(Player, i)
{
if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "bboxareaid")))
{
StopAudioStreamForPlayer(i);
SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
}
}
DeletePVar(playerid, "bboxareaid");
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, " You have removed your boombox.");
}
}
}
return 1;
}