COMMAND:criarradar(playerid, params[])
{
new Float , Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 7)
{
if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: /criarradar [Vel.Max]");
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, "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, "{FF0000} 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;
}
|