COMMAND:criarradar(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 5)
{
if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "{FFFF00}[INFO] {009D4F}Use: /criarradar [60 Cidade, 90 Estrada, 120 Rodovia]");
else
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
z = z - 1.0;
SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
if (ACameras[CamID][CamSpeed] == 0)
{
SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);
format(file, sizeof(file), CameraFile, CamID);
PFile = fopen(file, io_write);
format(LineForFile, 100, "CamX %f\r\n", x);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "CamY %f\r\n", y);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "CamZ %f\r\n", z);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "CamAngle %f\r\n", Angle);
fwrite(PFile, LineForFile);
format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
fwrite(PFile, LineForFile);
fclose(PFile);
format(Msg, 128, "{FFFF00}[INFO] {009D4F}Vocк criou o radar ID: %i", CamID);
SendClientMessage(playerid, 0x00FF00FF, Msg);
return 1;
}
}
// In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
format(Msg, 128, "{FFFF00}[INFO] {009D4F}Vocк nгo pode criar mais de %i radares.", MAX_CAMERAS);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
/* Include's */
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <DOF2>
/* New's */
new PlayerVip[MAX_PLAYERS];
/* Public's */
main(){}
public OnFilterScriptInit() return 1;
public OnFilterScriptExit() { DOF2_Exit(); return 1; }
public OnPlayerConnect(playerid)
{
new string[80];
format(string, sizeof(string), "/vips/%s.ini", GetName(playerid));
if(DOF2_FileExists(string))
{
PlayerVip[playerid] = DOF2_GetInt(string,"VipExpira");
if(gettime() > PlayerVip[playerid])
{
DOF2_RemoveFile(string);
PlayerVip[playerid] = 0;
SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Seu vip expirou!");
}
else
{
format(string, sizeof(string), "{A62CF2}VIP{FFFF00} Seu vip expira em %s.", convertNumber(PlayerVip[playerid]-gettime()));
SendClientMessage(playerid, -1, string);
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerVip[playerid] > 0)
{
if(gettime() > PlayerVip[playerid])
{
new string[40];
format(string, sizeof(string), "/vips/%s.ini", GetName(playerid));
DOF2_RemoveFile(string);
PlayerVip[playerid] = 0;
SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Seu vip expirou!");
}
else
{
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
}
}
return 1;
}
/* Stock's */
stock ConvertDays(dias)
{
new
valueday = 86400*dias,
daysconvert,
gtime = gettime()
;
#emit LOAD.S.PRI gtime
#emit LOAD.S.ALT valueday
#emit ADD
#emit STOR.S.PRI daysconvert
return daysconvert;
}
stock convertNumber(n)
{
new dia, hr, mn, seg, resto;
resto = n;
seg = resto % 60;
resto /= 60;
mn = resto % 60;
resto /= 60;
hr = resto % 24;
resto /= 24;
dia = resto;
new str[50];
format(str, sizeof(str), "%ddias, %02dh %02dm %02ds", dia, hr, mn, seg);
return str;
}
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
/* Command's */
CMD:vips(playerid)
{
new string[85];
new count;
SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Jogadores VIP's Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerVip[i] > 0)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "Vip %s (%d) [%s]", GetName(i), i, convertNumber(PlayerVip[i]-gettime()));
SendClientMessage(playerid, 0xE3E3E3FF, string);
count++;
}
}
}
if(count == 0)
return SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Nгo tem nenhum jogador vip on-line!");
return true;
}
CMD:darvip(playerid, params[])
{
new id, days, string[70];
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Vocк precisa estar logado na RCON para usar este comando!");
if(sscanf(params, "ud", id, days))
return SendClientMessage(playerid, -1, "{FFFF00}[INFO]{009D4F} /darvip [ID] [Dias]");
if(days < 0)
{
return SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Este jogador nгo estб online!");
}
else
{
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, -1, "{A62CF2}VIP{FFFF00} Este jogador nгo estб online!");
else
{
PlayerVip[id] = ConvertDays(days);
format(string, sizeof(string), "{A62CF2}VIP{FFFF00} Vocк deu %d dias de VIP para %s.", days, GetName(id));
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "{A62CF2}VIP{FFFF00} Vocк recebeu %d dias de VIP.", days);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), "/vips/%s.ini", GetName(id));
DOF2_CreateFile(string);
DOF2_SetInt(string,"VipExpira", PlayerVip[id]);
DOF2_SaveFile();
}
}
return true;
}
Ta vendo vocк, falou que o mano plagiou e copiou um FS que postei e pois como se fosse seu.. (so mudou mensagens e nomes).
|
atualizar o plugin streamer,sscanf e tbm as includes para versao 0.3x para os radares fucionar mais ja o vip nao sei
|
COMMAND:criarradar(playerid, params[])
{
// Setup local variables
new Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/criarradar", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 5)
{
if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/criarradar <Velocidade>\"");
else
{
// Get player's position and facing angle
new xRL [ 128 ], Float:x ;
GetPlayerFacingAngle(playerid, Angle);
GetPlayerPos(playerid,x,y,z);
format(xRL, sizeof(xRL), "{FF0000}Radar:{FFFFFF} \nVelocidade Mбxima:\n {00FF00}%i Kmh", MaxSpeed);
Create3DTextLabel(xRL, 0xFFFFFFFF, x, y, z, 150.0, 0, 0);
z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)
// Move the player a bit, otherwise he could get stuck inside the camera-object
SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
// Save the camera to a file
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this index is free
if (ACameras[CamID][CamSpeed] == 0)
{
// Setup this camera (create the objects and store the data)
SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);
// Save the file
format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
PFile = fopen(file, io_write); // Open the camera-file for writing
format(LineForFile, 100, "CamX %f\r\n", x);
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, 100, "CamY %f\r\n", y);
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, 100, "CamZ %f\r\n", z);
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, 100, "CamAngle %f\r\n", Angle);
fwrite(PFile, LineForFile); // And save it to the file
format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
fwrite(PFile, LineForFile); // And save it to the file
fclose(PFile); // Close the file
// Let the player know he created a new camera
format(Msg, 128, "Voce Criou o Radar de ID: %i", CamID);
SendClientMessage(playerid, 0x00FF00FF, Msg);
// Exit the function
return 1;
}
}
// In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
format(Msg, 128, "{FF0000}Voce nao Pode Criar mais de %i Radares", MAX_CAMERAS);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
return 0;
}
else
return 0;
return 1;
}
Tenta esse,ele fala a velocidade do radar Dinamicamente com 3DTextLabel:
pawn Код:
|
O problema nгo e na criaзгo do radar e sim na hora de fazer ele ser criado , na callback SetupSpeedCamera.
|
SetupSpeedCamera(CamID, Float:x, Float:y, Float:z, Float:rot, MaxSpeed)
{
ACameras[CamID][CamX] = x;
ACameras[CamID][CamY] = y;
ACameras[CamID][CamZ] = z;
ACameras[CamID][CamAngle] = rot;
ACameras[CamID][CamSpeed] = MaxSpeed;
ACameras[CamID][CamObj1] = CreateObject(18880, x, y, z, 0.0, 0.0, rot);
ACameras[CamID][CamObj2] = CreateObject(18880, x, y, z, 0.0, 0.0, rot + 180.0);
ACameras[CamID][CamIcon] = CreateDynamicMapIcon(x, y, z, 34, 0, 0, 0, -1, 150.0);
new str[47];
format (str,sizeof(str),"{FF0000}Vel. Mбxima\n{FFFF00}%i {FF0000}Km/H", ACameras[CamID][CamSpeed]);
Create3DTextLabel(str, 0x008080FF, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ], 40.0, 0, 0);
}
O meu tambйm rsrs
Vocк sabe algum SetupSpeedCamera sem estб bugado mano? Olha o meu ae: PHP код:
|
No SetupSpeedCamera tem dois CreateObject , muda para CreateDynamicObject. |